summaryrefslogtreecommitdiff
path: root/ifpps.c
diff options
context:
space:
mode:
Diffstat (limited to 'ifpps.c')
-rw-r--r--ifpps.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ifpps.c b/ifpps.c
index 60cd3b3..a0e3d13 100644
--- a/ifpps.c
+++ b/ifpps.c
@@ -746,6 +746,20 @@ static void screen_net_dev_rel(WINDOW *screen, const struct ifstat *rel,
attroff(A_REVERSE);
}
+static void screen_net_dev_percentage(WINDOW *screen, const struct ifstat *rel,
+ int *voff, u32 rate)
+{
+ mvwprintw(screen, (*voff)++, 0,
+ " rx: %15.2llf%% of line rate "
+ " ",
+ rate ? ((((long double) rel->rx_bytes) / (1LLU << 20)) / rate) * 100.0 : 0.0);
+
+ mvwprintw(screen, (*voff)++, 0,
+ " tx: %15.2llf%% of line rate "
+ " ",
+ rate ? ((((long double) rel->tx_bytes) / (1LLU << 20)) / rate) * 100.0 : 0.0);
+}
+
static void screen_net_dev_abs(WINDOW *screen, const struct ifstat *abs,
int *voff)
{
@@ -1056,6 +1070,9 @@ static void screen_update(WINDOW *screen, const char *ifname, const struct ifsta
screen_net_dev_rel(screen, rel, &voff);
voff++;
+ screen_net_dev_percentage(screen, rel, &voff, rate);
+
+ voff++;
screen_net_dev_abs(screen, abs, &voff);
voff++;