1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

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.
This commit is contained in:
Marcus Nilsson 2022-01-16 14:15:02 +01:00 committed by Andreas Kling
parent a5b11f7484
commit 8b39ec7c18

View file

@ -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);