Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
nethogs
Clarify-units.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File Clarify-units.patch of Package nethogs
From 4e31a8d8910ba36fb0170e87dc39be0c9f4eaf68 Mon Sep 17 00:00:00 2001 From: Michal Suchanek <msuchanek@suse.de> 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 <msuchanek@suse.de> (cherry picked from commit e40699fba4610c92faa36f64954c762908c81d8b) --- cui.cpp | 12 ++++++------ main.cpp | 4 ++-- nethogs.8 | 6 ++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cui.cpp b/cui.cpp index 4662496..f540de0 100644 --- a/cui.cpp +++ b/cui.cpp @@ -137,7 +137,7 @@ void Line::show (int row, unsigned int proglen) mvprintw (row, 8 + 9 + proglen + 2 + 6 + 9 + 3, "%10.3f", recv_value); if (viewMode == VIEWMODE_KBPS) { - mvprintw (row, 8 + 9 + proglen + 2 + 6 + 9 + 3 + 11, "KB/sec"); + mvprintw (row, 8 + 9 + proglen + 2 + 6 + 9 + 3 + 11, "kB/sec"); } else if (viewMode == VIEWMODE_TOTAL_MB) { @@ -145,11 +145,11 @@ void Line::show (int row, unsigned int proglen) } else if (viewMode == VIEWMODE_TOTAL_KB) { - mvprintw (row, 8 + 9 + proglen + 2 + 6 + 9 + 3 + 11, "KB "); + mvprintw (row, 8 + 9 + proglen + 2 + 6 + 9 + 3 + 11, "kB "); } else if (viewMode == VIEWMODE_TOTAL_B) { - mvprintw (row, 8 + 9 + proglen + 2 + 6 + 9 + 3 + 11, "B "); + mvprintw (row, 8 + 9 + proglen + 2 + 6 + 9 + 3 + 11, "bytes "); } } @@ -397,11 +397,11 @@ void show_ncurses(Line * lines[], int nproc) { mvprintw (totalrow, 0, " TOTAL %-*.*s %10.3f %10.3f ", proglen, proglen, " ", sent_global, recv_global); if (viewMode == VIEWMODE_KBPS) { - mvprintw (3+1+i, cols - 7, "KB/sec "); + mvprintw (3+1+i, cols - 7, "kB/sec "); } else if (viewMode == VIEWMODE_TOTAL_B) { - mvprintw (3+1+i, cols - 7, "B "); + mvprintw (3+1+i, cols - 7, "bytes "); } else if (viewMode == VIEWMODE_TOTAL_KB) { - mvprintw (3+1+i, cols - 7, "KB "); + mvprintw (3+1+i, cols - 7, "kB "); } else if (viewMode == VIEWMODE_TOTAL_MB) { mvprintw (3+1+i, cols - 7, "MB "); } diff --git a/main.cpp b/main.cpp index 6797a22..d940fa5 100644 --- a/main.cpp +++ b/main.cpp @@ -12,7 +12,7 @@ static void help(void) std::cerr << " -V : prints version.\n"; std::cerr << " -b : bughunt mode - implies tracemode.\n"; std::cerr << " -d : delay for update refresh rate in seconds. default is 1.\n"; - std::cerr << " -v : view mode (0 = KB/s, 1 = total KB, 2 = total B, 3 = total MB). default is 0.\n"; + std::cerr << " -v : view mode (0 = kB/s, 1 = total kB, 2 = total bytes, 3 = total MB). default is 0.\n"; std::cerr << " -c : number of updates. default is 0 (unlimited).\n"; std::cerr << " -t : tracemode.\n"; //std::cerr << " -f : format of packets on interface, default is eth.\n"; @@ -24,7 +24,7 @@ static void help(void) std::cerr << " q: quit\n"; std::cerr << " s: sort by SENT traffic\n"; std::cerr << " r: sort by RECEIVE traffic\n"; - std::cerr << " m: switch between total (KB, B, MB) and KB/s mode\n"; + std::cerr << " m: switch between total (kB, bytes, MB) and kB/s mode\n"; } int main (int argc, char** argv) diff --git a/nethogs.8 b/nethogs.8 index 489b303..5b87622 100644 --- a/nethogs.8 +++ b/nethogs.8 @@ -30,7 +30,9 @@ prints Version info. delay for refresh rate. .TP \fB-v\fP -select view mode +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 .TP \fB-p\fP sniff in promiscious mode (not recommended). @@ -50,7 +52,7 @@ to monitor. By default eth0 is being used. .SH "INTERACTIVE CONTROL" .TP m -cycle between display modes (kb/s, kb, b, mb) +cycle between display modes (kB/s, kB, bytes, MB) .TP r sort by 'received' -- 2.41.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor