From cd39eea7a9f44b55ecf36c3b3fe5abf7ea9f94cc Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sun, 2 Aug 2020 16:35:49 +0200 Subject: [PATCH] SystemMonitor: Split up kmalloc labels Otherwise, the numbers overflow the space after a while. --- Applications/SystemMonitor/MemoryStatsWidget.cpp | 14 +++++++++----- Applications/SystemMonitor/MemoryStatsWidget.h | 4 +++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Applications/SystemMonitor/MemoryStatsWidget.cpp index 89bd77fdc4..809a8aaecb 100644 --- a/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -50,7 +50,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph) s_the = this; set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); - set_preferred_size(0, 72); + set_preferred_size(0, 110); set_layout(); layout()->set_margins({ 0, 8, 0, 0 }); @@ -71,8 +71,10 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph) m_user_physical_pages_label = build_widgets_for_label("Userspace physical:"); m_supervisor_physical_pages_label = build_widgets_for_label("Supervisor physical:"); - m_kmalloc_label = build_widgets_for_label("Kernel heap:"); - m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc/kfree:"); + m_kmalloc_space_label = build_widgets_for_label("Kernel heap:"); + m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc:"); + m_kfree_count_label = build_widgets_for_label("Calls kfree:"); + m_kmalloc_difference_label = build_widgets_for_label("Difference:"); refresh(); } @@ -117,10 +119,12 @@ void MemoryStatsWidget::refresh() size_t user_pages_available = user_physical_allocated + user_physical_available; size_t supervisor_pages_available = super_physical_alloc + super_physical_free; - m_kmalloc_label->set_text(String::format("%uK/%uK", bytes_to_kb(kmalloc_allocated), bytes_to_kb(kmalloc_sum_available))); + m_kmalloc_space_label->set_text(String::format("%uK/%uK", bytes_to_kb(kmalloc_allocated), bytes_to_kb(kmalloc_sum_available))); m_user_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(user_physical_allocated), page_count_to_kb(user_pages_available))); m_supervisor_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(super_physical_alloc), page_count_to_kb(supervisor_pages_available))); - m_kmalloc_count_label->set_text(String::format("%u/%u (+%u)", kmalloc_call_count, kfree_call_count, kmalloc_call_count - kfree_call_count)); + m_kmalloc_count_label->set_text(String::format("%u", kmalloc_call_count)); + m_kfree_count_label->set_text(String::format("%u", kfree_call_count)); + m_kmalloc_difference_label->set_text(String::format("+%u", kmalloc_call_count - kfree_call_count)); m_graph.set_max(page_count_to_kb(user_pages_available)); m_graph.add_value(page_count_to_kb(user_physical_allocated)); diff --git a/Applications/SystemMonitor/MemoryStatsWidget.h b/Applications/SystemMonitor/MemoryStatsWidget.h index f2d8c2c36a..18c3f7a974 100644 --- a/Applications/SystemMonitor/MemoryStatsWidget.h +++ b/Applications/SystemMonitor/MemoryStatsWidget.h @@ -45,6 +45,8 @@ private: GraphWidget& m_graph; RefPtr m_user_physical_pages_label; RefPtr m_supervisor_physical_pages_label; - RefPtr m_kmalloc_label; + RefPtr m_kmalloc_space_label; RefPtr m_kmalloc_count_label; + RefPtr m_kfree_count_label; + RefPtr m_kmalloc_difference_label; };