Option to display packet counts - Frédéric Perrin <fperrin@brocade.com>

Add a "-u unit" CLI option, as well as a "bandwidth-unit" configuration
file option. With "-u packets", traffic is accounted using packets per
second; the other options are "-u bits" and "-u bytes".

"-B" is still recognized as synonym to "-u bytes".

The default is "-u bits", keeping the current behaviour of iftop
(everything is in bits/s, except the cumulative totals).
This commit is contained in:
Paul Warren
2017-01-04 23:03:34 +00:00
parent eb087b0c83
commit 9addd978c4
9 changed files with 112 additions and 47 deletions

View File

@@ -34,6 +34,12 @@ typedef enum {
OPTION_LINEDISPLAY_ONE_LINE_SENT
} option_linedisplay_t;
typedef enum {
OPTION_BW_BITS,
OPTION_BW_BYTES,
OPTION_BW_PKTS,
} option_bw_unit_t;
/*
* This structure has to be defined in the same order as the config
* directives in cfgfile.c. Clearly this is EBW.
@@ -59,7 +65,7 @@ typedef struct {
int timed_output;
int no_curses;
int num_lines;
int bandwidth_in_bytes;
option_bw_unit_t bandwidth_unit;
option_sort_t sort;
int bar_interval;