forked from osmocom/wireshark
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>
This commit is contained in:
parent
997e21d1e9
commit
e253e62750
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue