summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2022-01-16 14:15:02 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-16 15:04:40 +0100
commit8b39ec7c18e558b7230d2e08c9172d6b6d12571b (patch)
treef1601cbf8d799a77be6c16c32405514f2c3b6982
parenta5b11f7484494489c5cc68d61dff23eb6ca4f0f4 (diff)
downloadserenity-8b39ec7c18e558b7230d2e08c9172d6b6d12571b.zip
SystemMonitor: Don't display empty CPU graphs when number of CPUs < 4
When we have less than 4 CPUs we don't need to display a whole row of CPU graphs.
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index 061388d605..07d3c9708f 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -670,7 +670,7 @@ NonnullRefPtr<GUI::Widget> build_performance_tab()
auto& cpu_graph_group_box = graphs_container->add<GUI::GroupBox>("CPU usage");
cpu_graph_group_box.set_layout<GUI::VerticalBoxLayout>();
- static constexpr size_t cpu_graphs_per_row = 4;
+ size_t cpu_graphs_per_row = min(4, ProcessModel::the().cpus().size());
auto cpu_graph_rows = ceil_div(ProcessModel::the().cpus().size(), cpu_graphs_per_row);
cpu_graph_group_box.set_fixed_height(120u * cpu_graph_rows);