From 08524d2740d88288b9b73c5c462d661ef726e169 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Mon, 28 Aug 2023 13:00:10 +0200 Subject: [PATCH] Clarify units On the internet the usage of b and B for bits or bytes is inconsistent. Lowercase b seems to be used for either, and upperace B is more often used to mean bytes but usege for bits also exists. I am not aware of any standard that would mandate one or other use. Consequently, spelling out the whole word in the output or adding explanation in documentation is the only way to make sure the output is interpreted correctly. To save space on small screens only alter documentation and the bytes label without prefixes/suffixes. While at it change uppercase K to lowercase k to correctly spell the kilo- prefix. Fixes: #261 Signed-off-by: Michal Suchanek --- doc/nethogs.8 | 4 +++- src/cui.cpp | 2 +- src/main.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/nethogs.8 b/doc/nethogs.8 index 3c827a7..e291684 100644 --- a/doc/nethogs.8 +++ b/doc/nethogs.8 @@ -41,7 +41,9 @@ bughunt mode - implies tracemode. delay for update refresh rate in seconds. default is 1. .TP \fB-v\fP -view mode (0 = KB/s, 1 = total KB, 2 = total B, 3 = total MB, 4 = MB/s, 5 = GB/s). default is 0. +view mode (0 = kB/s, 1 = total kB, 2 = total bytes, 3 = total MB, 4 = MB/s, 5 = GB/s). default is 0. + +kB: 2e10 bytes, MB: 2e20 bytes, GB: 2e30 bytes .TP \fB-c\fP number of updates. default is 0 (unlimited). diff --git a/src/cui.cpp b/src/cui.cpp index 40a7455..137bce6 100644 --- a/src/cui.cpp +++ b/src/cui.cpp @@ -68,7 +68,7 @@ const char *COLUMN_FORMAT_RECEIVED = "%11.3f"; // All descriptions are padded to 6 characters in length with spaces const char *const desc_view_mode[VIEWMODE_COUNT] = { - "KB/s ", "KB ", "B ", "MB ", "MB/s ", "GB/s "}; + "kB/s ", "kB ", "bytes ", "MB ", "MB/s ", "GB/s "}; constexpr char FILE_SEPARATOR = '/'; diff --git a/src/main.cpp b/src/main.cpp index de95c5f..7501461 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,8 +38,8 @@ static void help(bool iserror) { output << " -x : bughunt mode - implies tracemode.\n"; output << " -d : delay for update refresh rate in seconds. default " "is 1.\n"; - output << " -v : view mode (0 = KB/s, 1 = total KB, 2 = total B, 3 " - "= total MB, 4 = MB/s, 5 = GB/s). default is 0.\n"; + output << " -v : view mode (0 = kB/s, 1 = total kB, 2 = " + "total bytes, 3 = total MB, 4 = MB/s, 5 = GB/s). default is 0.\n"; output << " -c : number of updates. default is 0 (unlimited).\n"; output << " -t : tracemode.\n"; // output << " -f : format of packets on interface, default is @@ -67,8 +67,8 @@ static void help(bool iserror) { output << " r: sort by RECEIVED traffic\n"; output << " l: display command line\n"; output << " b: display the program basename instead of the fullpath\n"; - output << " m: switch between total (KB, B, MB) and throughput (KB/s, MB/s, " - "GB/s) mode\n"; + output << " m: switch between total (kB, bytes, MB) and throughput (kB/s, " + " MB/s, GB/s) mode\n"; } void quit_cb(int /* i */) {