summaryrefslogtreecommitdiff
path: root/Userland/Applications/SystemMonitor/MemoryStatsWidget.h
blob: 3305aaf0d8d229a0e373ae6ae2bf07f885fd53f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 * Copyright (c) 2022, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibGUI/Widget.h>

namespace SystemMonitor {

class GraphWidget;

class MemoryStatsWidget final : public GUI::Widget {
    C_OBJECT(MemoryStatsWidget)
public:
    static MemoryStatsWidget* the();

    virtual ~MemoryStatsWidget() override = default;

    void set_graph_widget(GraphWidget& graph);

    void set_graph_widget_via_name(DeprecatedString name);
    DeprecatedString graph_widget_name();

    void refresh();

private:
    MemoryStatsWidget(GraphWidget* graph);
    MemoryStatsWidget();

    GraphWidget* m_graph;
    // Is null if we have a valid graph
    DeprecatedString m_graph_widget_name {};
    RefPtr<GUI::Label> m_physical_pages_label;
    RefPtr<GUI::Label> m_physical_pages_committed_label;
    RefPtr<GUI::Label> m_kmalloc_space_label;
    RefPtr<GUI::Label> m_kmalloc_count_label;
    RefPtr<GUI::Label> m_kfree_count_label;
    RefPtr<GUI::Label> m_kmalloc_difference_label;
};

}