1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

SystemMonitor: Make memory statistics dynamically formatted by size

Previously all memory values on the performance was formatted as KiB,
but with such formatting it can be quite hard to read large numbers
(as mentioned by Andreas on todays office hours livestream :^)).
This patch makes use of the human readable formatting utilies and
displays them in an easier to read format.
This commit is contained in:
David Isaksson 2021-09-03 18:26:58 +02:00 committed by Andreas Kling
parent 7224308358
commit 9699648b2a
2 changed files with 20 additions and 14 deletions

View file

@ -710,20 +710,20 @@ NonnullRefPtr<GUI::Widget> build_performance_tab()
memory_graph.set_stack_values(true);
memory_graph.set_value_format(0, {
.graph_color_role = ColorRole::SyntaxComment,
.text_formatter = [](int value) {
return String::formatted("Committed: {} KiB", value);
.text_formatter = [](int bytes) {
return String::formatted("Committed: {}", human_readable_size(bytes));
},
});
memory_graph.set_value_format(1, {
.graph_color_role = ColorRole::SyntaxPreprocessorStatement,
.text_formatter = [](int value) {
return String::formatted("Allocated: {} KiB", value);
.text_formatter = [](int bytes) {
return String::formatted("Allocated: {}", human_readable_size(bytes));
},
});
memory_graph.set_value_format(2, {
.graph_color_role = ColorRole::SyntaxPreprocessorValue,
.text_formatter = [](int value) {
return String::formatted("Kernel heap: {} KiB", value);
.text_formatter = [](int bytes) {
return String::formatted("Kernel heap: {}", human_readable_size(bytes));
},
});