diff options
author | Michael Mann <mmann78@netscape.net> | 2018-12-28 10:56:44 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-12-03 03:17:52 +0000 |
commit | e253e62750b5d5ec74b8368ea1e1e2dd933fb336 (patch) | |
tree | 929909f8f539aa09a1ca37c9a51d8a8612ebd5a3 /ui | |
parent | 997e21d1e9d71bbf13a5d49307ed171ba6afbeda (diff) |
Use human-readable numbers for conversation stats
Bug: 15360
Change-Id: Iceaa5c2336cfb58966ef12f4267fcd09ae48bfe7
Reviewed-on: https://code.wireshark.org/review/31234
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/cli/tap-iousers.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/ui/cli/tap-iousers.c b/ui/cli/tap-iousers.c index 6c52d829e5..3295b386d8 100644 --- a/ui/cli/tap-iousers.c +++ b/ui/cli/tap-iousers.c @@ -16,6 +16,7 @@ #include <string.h> #include <epan/packet.h> #include <epan/timestamp.h> +#include <epan/strutil.h> #include <ui/cmdarg_err.h> #include <ui/cli/tshark-tap.h> @@ -45,7 +46,7 @@ iousers_draw(void *arg) case TS_UTC: printf("%s | <- | | -> | | Total | Absolute Time | Duration |\n", display_ports ? " " : ""); - printf("%s | Frames Bytes | | Frames Bytes | | Frames Bytes | Start | |\n", + printf("%s | Frames Size | | Frames Size | | Frames Size | Start | |\n", display_ports ? " " : ""); break; case TS_ABSOLUTE_WITH_YMD: @@ -54,7 +55,7 @@ iousers_draw(void *arg) case TS_UTC_WITH_YDOY: printf("%s | <- | | -> | | Total | Absolute Date | Duration |\n", display_ports ? " " : ""); - printf("%s | Frames Bytes | | Frames Bytes | | Frames Bytes | Start | |\n", + printf("%s | Frames Size | | Frames Size | | Frames Size | Start | |\n", display_ports ? " " : ""); break; case TS_RELATIVE: @@ -89,6 +90,12 @@ iousers_draw(void *arg) tot_frames = iui->rx_frames + iui->tx_frames; if (tot_frames == last_frames) { + char *rx_bytes, *tx_bytes, *total_bytes; + + rx_bytes = format_size_wmem(NULL, iui->rx_bytes, (format_size_flags_e)(format_size_unit_bytes|format_size_suffix_no_space)); + tx_bytes = format_size_wmem(NULL, iui->tx_bytes, (format_size_flags_e)(format_size_unit_bytes|format_size_suffix_no_space)); + total_bytes = format_size_wmem(NULL, iui->tx_bytes + iui->rx_bytes, (format_size_flags_e)(format_size_unit_bytes|format_size_suffix_no_space)); + /* XXX - TODO: make name / port resolution configurable (through gbl_resolv_flags?) */ src_addr = get_conversation_address(NULL, &iui->src_address, TRUE); dst_addr = get_conversation_address(NULL, &iui->dst_address, TRUE); @@ -98,33 +105,36 @@ iousers_draw(void *arg) dst_port = get_conversation_port(NULL, iui->dst_port, iui->etype, TRUE); src = wmem_strconcat(NULL, src_addr, ":", src_port, NULL); dst = wmem_strconcat(NULL, dst_addr, ":", dst_port, NULL); - printf("%-26s <-> %-26s %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER - "u %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u %6" - G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u ", + printf("%-26s <-> %-26s %6" G_GINT64_MODIFIER "u %-9s" + " %6" G_GINT64_MODIFIER "u %-9s" + " %6" G_GINT64_MODIFIER "u %-9s ", src, dst, - iui->rx_frames, iui->rx_bytes, - iui->tx_frames, iui->tx_bytes, + iui->rx_frames, rx_bytes, + iui->tx_frames, tx_bytes, iui->tx_frames+iui->rx_frames, - iui->tx_bytes+iui->rx_bytes + total_bytes ); wmem_free(NULL, src_port); wmem_free(NULL, dst_port); wmem_free(NULL, src); wmem_free(NULL, dst); } else { - printf("%-20s <-> %-20s %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER - "u %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u %6" - G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u ", + printf("%-20s <-> %-20s %6" G_GINT64_MODIFIER "u %-9s" + " %6" G_GINT64_MODIFIER "u %-9s" + " %6" G_GINT64_MODIFIER "u %-9s ", src_addr, dst_addr, - iui->rx_frames, iui->rx_bytes, - iui->tx_frames, iui->tx_bytes, + iui->rx_frames, rx_bytes, + iui->tx_frames, tx_bytes, iui->tx_frames+iui->rx_frames, - iui->tx_bytes+iui->rx_bytes + total_bytes ); } wmem_free(NULL, src_addr); wmem_free(NULL, dst_addr); + wmem_free(NULL, rx_bytes); + wmem_free(NULL, tx_bytes); + wmem_free(NULL, total_bytes); switch (timestamp_get_type()) { case TS_ABSOLUTE: |