From 8b39ec7c18e558b7230d2e08c9172d6b6d12571b Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Sun, 16 Jan 2022 14:15:02 +0100 Subject: 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. --- Userland/Applications/SystemMonitor/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 build_performance_tab() auto& cpu_graph_group_box = graphs_container->add("CPU usage"); cpu_graph_group_box.set_layout(); - 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); -- cgit v1.2.3