diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2015-10-24 17:38:07 +0300 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-10-26 13:23:30 +0100 |
commit | e97a3b2a56efdb1833c6f1228f50b2636977647e (patch) | |
tree | 485e82803909748d034ba3c9b7c4e44e0ba20707 | |
parent | 49a4952ee52d8a89eb70cd3127a35c97929f63e4 (diff) |
flowtop: Change traffic amount unit names
Use GB/MB/KB for traffic rate & accounting.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | flowtop.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -781,13 +781,13 @@ static uint16_t presenter_get_port(uint16_t src, uint16_t dst, bool is_tcp) static char *bandw2str(double bytes, char *buf, size_t len) { if (bytes > 1000000000.) - snprintf(buf, len, "%.1fG", bytes / 1000000000.); + snprintf(buf, len, "%.1fGB", bytes / 1000000000.); else if (bytes > 1000000.) - snprintf(buf, len, "%.1fM", bytes / 1000000.); + snprintf(buf, len, "%.1fMB", bytes / 1000000.); else if (bytes > 1000.) - snprintf(buf, len, "%.1fK", bytes / 1000.); + snprintf(buf, len, "%.1fKB", bytes / 1000.); else - snprintf(buf, len, "%g", bytes); + snprintf(buf, len, "%g bytes", bytes); return buf; } @@ -795,11 +795,11 @@ static char *bandw2str(double bytes, char *buf, size_t len) static char *rate2str(double rate, char *buf, size_t len) { if (rate > 1000000000.) - snprintf(buf, len, "%.1fGb/s", rate / 1000000000.); + snprintf(buf, len, "%.1fGB/s", rate / 1000000000.); else if (rate > 1000000.) - snprintf(buf, len, "%.1fMb/s", rate / 1000000.); + snprintf(buf, len, "%.1fMB/s", rate / 1000000.); else if (rate > 1000.) - snprintf(buf, len, "%.1fKb/s", rate / 1000.); + snprintf(buf, len, "%.1fKB/s", rate / 1000.); else snprintf(buf, len, "%gB/s", rate); @@ -818,7 +818,7 @@ static void presenter_print_counters(uint64_t bytes, uint64_t pkts, if (rate_pkts) printw("(%.1fpps)", rate_pkts); - printw(", %s bytes", bandw2str(bytes, bytes_str, sizeof(bytes_str) - 1)); + printw(", %s", bandw2str(bytes, bytes_str, sizeof(bytes_str) - 1)); if (rate_bytes) printw("(%s)", rate2str(rate_bytes, bytes_str, sizeof(bytes_str) - 1)); |