summaryrefslogtreecommitdiff
path: root/Applications/SystemMonitor/main.cpp
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2020-08-21 02:42:32 +0100
committerAndreas Kling <kling@serenityos.org>2020-08-21 12:01:36 +0200
commit4dfe797263ce5e8fe1316b36e68b5190a7e1d1d0 (patch)
treed66c4c42307cb6ef4eb166df438932c5a17c7acc /Applications/SystemMonitor/main.cpp
parent5c60a6a8fbb21cd8de4a68778814c442b2835ca5 (diff)
downloadserenity-4dfe797263ce5e8fe1316b36e68b5190a7e1d1d0.zip
SystemMonitor: Add a Processors tab
Diffstat (limited to 'Applications/SystemMonitor/main.cpp')
-rw-r--r--Applications/SystemMonitor/main.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index 8c22c51de3..0adbb22c9c 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -66,6 +66,7 @@ static NonnullRefPtr<GUI::Widget> build_file_systems_tab();
static NonnullRefPtr<GUI::Widget> build_pci_devices_tab();
static NonnullRefPtr<GUI::Widget> build_devices_tab();
static NonnullRefPtr<GUI::Widget> build_graphs_tab();
+static NonnullRefPtr<GUI::Widget> build_processors_tab();
class UnavailableProcessWidget final : public GUI::Frame {
C_OBJECT(UnavailableProcessWidget)
@@ -173,6 +174,8 @@ int main(int argc, char** argv)
auto network_stats_widget = NetworkStatisticsWidget::construct();
tabwidget.add_widget("Network", network_stats_widget);
+ tabwidget.add_widget("Processors", build_processors_tab());
+
process_table_container.set_layout<GUI::VerticalBoxLayout>();
process_table_container.layout()->set_spacing(0);
@@ -566,3 +569,29 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
};
return graphs_container;
}
+
+NonnullRefPtr<GUI::Widget> build_processors_tab()
+{
+ auto processors_widget = GUI::LazyWidget::construct();
+
+ processors_widget->on_first_show = [](GUI::LazyWidget& self) {
+ self.set_layout<GUI::VerticalBoxLayout>();
+ self.layout()->set_margins({ 4, 4, 4, 4 });
+
+ Vector<GUI::JsonArrayModel::FieldSpec> processors_field;
+ processors_field.empend("processor", "Processor", Gfx::TextAlignment::CenterRight);
+ processors_field.empend("cpuid", "CPUID", Gfx::TextAlignment::CenterLeft);
+ processors_field.empend("brandstr", "Brand", Gfx::TextAlignment::CenterLeft);
+ processors_field.empend("features", "Features", Gfx::TextAlignment::CenterLeft);
+ processors_field.empend("family", "Family", Gfx::TextAlignment::CenterRight);
+ processors_field.empend("model", "Model", Gfx::TextAlignment::CenterRight);
+ processors_field.empend("stepping", "Stepping", Gfx::TextAlignment::CenterRight);
+ processors_field.empend("type", "Type", Gfx::TextAlignment::CenterRight);
+
+ auto& processors_table_view = self.add<GUI::TableView>();
+ processors_table_view.set_model(GUI::JsonArrayModel::create("/proc/cpuinfo", move(processors_field)));
+ processors_table_view.model()->update();
+ };
+
+ return processors_widget;
+}