Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
nethogs.30668
Clarify-units.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File Clarify-units.patch of Package nethogs.30668
From cf3ddc2be7880534e47710433f726b062167d2cb 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) --- doc/nethogs.8 | 6 ++++-- src/cui.cpp | 12 ++++++------ src/main.cpp | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/nethogs.8 b/doc/nethogs.8 index 489b303..9bfde54 100644 --- a/doc/nethogs.8 +++ b/doc/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, GB: 2e30 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' diff --git a/src/cui.cpp b/src/cui.cpp index d5197a9..88651f5 100644 --- a/src/cui.cpp +++ b/src/cui.cpp @@ -184,13 +184,13 @@ void Line::show(int row, unsigned int proglen) { mvprintw(row, column_offset_received, COLUMN_FORMAT_RECEIVED, recv_value); if (viewMode == VIEWMODE_KBPS) { - mvaddstr(row, column_offset_unit, "KB/sec"); + mvaddstr(row, column_offset_unit, "kB/sec"); } else if (viewMode == VIEWMODE_TOTAL_MB) { mvaddstr(row, column_offset_unit, "MB "); } else if (viewMode == VIEWMODE_TOTAL_KB) { - mvaddstr(row, column_offset_unit, "KB "); + mvaddstr(row, column_offset_unit, "kB "); } else if (viewMode == VIEWMODE_TOTAL_B) { - mvaddstr(row, column_offset_unit, "B "); + mvaddstr(row, column_offset_unit, "bytes "); } } @@ -330,11 +330,11 @@ void show_ncurses(Line *lines[], int nproc) { mvprintw(totalrow, 0, " TOTAL %-*.*s %11.3f %11.3f ", proglen, proglen, " ", sent_global, recv_global); if (viewMode == VIEWMODE_KBPS) { - mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "KB/sec "); + mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "kB/sec "); } else if (viewMode == VIEWMODE_TOTAL_B) { - mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "B "); + mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "bytes "); } else if (viewMode == VIEWMODE_TOTAL_KB) { - mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "KB "); + mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "kB "); } else if (viewMode == VIEWMODE_TOTAL_MB) { mvprintw(3 + 1 + i, cols - COLUMN_WIDTH_UNIT, "MB "); } diff --git a/src/main.cpp b/src/main.cpp index 5137a0f..cac10e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,8 +33,8 @@ static void help(bool iserror) { output << " -b : 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). default is 0.\n"; + output << " -v : view mode (0 = kB/s, 1 = total kB, 2 = " + "total bytes, 3 = total MB). 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 @@ -49,7 +49,7 @@ static void help(bool iserror) { output << " q: quit\n"; output << " s: sort by SENT traffic\n"; output << " r: sort by RECEIVE traffic\n"; - output << " m: switch between total (KB, B, MB) and KB/s mode\n"; + output << " m: switch between total (kB, bytes, MB) and kB/s mode\n"; } void quit_cb(int /* i */) { -- 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