Serenity Operating System
1/*
2 * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
3 * Copyright (c) 2022, the SerenityOS developers.
4 *
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8#pragma once
9
10#include <LibGUI/Model.h>
11
12namespace Profiler {
13
14class Profile;
15
16class SamplesModel final : public GUI::Model {
17public:
18 static NonnullRefPtr<SamplesModel> create(Profile& profile)
19 {
20 return adopt_ref(*new SamplesModel(profile));
21 }
22
23 enum Column {
24 SampleIndex,
25 Timestamp,
26 ProcessID,
27 ThreadID,
28 ExecutableName,
29 LostSamples,
30 InnermostStackFrame,
31 Path,
32 __Count
33 };
34
35 virtual ~SamplesModel() override = default;
36
37 virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
38 virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
39 virtual DeprecatedString column_name(int) const override;
40 virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
41 virtual bool is_column_sortable(int) const override { return false; }
42
43private:
44 explicit SamplesModel(Profile&);
45
46 Profile& m_profile;
47
48 GUI::Icon m_user_frame_icon;
49 GUI::Icon m_kernel_frame_icon;
50};
51
52}