summaryrefslogtreecommitdiff
path: root/Applications/SystemMonitor
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2020-08-15 14:05:46 -0400
committerAndreas Kling <kling@serenityos.org>2020-08-16 16:33:28 +0200
commitaa9716673988597d270ee6223b42d5207fddc1ad (patch)
tree2e17b9cb0762f60865d8605552763fb49f596f5e /Applications/SystemMonitor
parent430b265cd45167fb2dca2323ea5f5b910be00a1d (diff)
downloadserenity-aa9716673988597d270ee6223b42d5207fddc1ad.zip
Everywhere: Consolidate human_readable_size() implementations
Let's use the one in AK/NumberFormat.h everywhere. It has slightly different behavior than some of the copies this removes, but it's probably nice to have uniform human readable size outputs across the system.
Diffstat (limited to 'Applications/SystemMonitor')
-rw-r--r--Applications/SystemMonitor/main.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index eb58978a90..c8b69a80bc 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -31,8 +31,9 @@
#include "ProcessFileDescriptorMapWidget.h"
#include "ProcessMemoryMapWidget.h"
#include "ProcessModel.h"
-#include "ThreadStackWidget.h"
#include "ProcessUnveiledPathsWidget.h"
+#include "ThreadStackWidget.h"
+#include <AK/NumberFormat.h>
#include <LibCore/Timer.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/Action.h>
@@ -61,17 +62,6 @@
#include <stdio.h>
#include <unistd.h>
-static String human_readable_size(u32 size)
-{
- if (size < (64 * KiB))
- return String::format("%u", size);
- if (size < MiB)
- return String::format("%u KB", size / KiB);
- if (size < GiB)
- return String::format("%u MB", size / MiB);
- return String::format("%u GB", size / GiB);
-}
-
static NonnullRefPtr<GUI::Widget> build_file_systems_tab();
static NonnullRefPtr<GUI::Widget> build_pci_devices_tab();
static NonnullRefPtr<GUI::Widget> build_devices_tab();