summaryrefslogtreecommitdiff
path: root/ifpps.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-09-09 12:40:14 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-09-09 12:40:14 +0200
commitdefd121efe1c394fe002ce9b0f36a2422a054af7 (patch)
treec448f569c3dcf303f5943bfe6a973ff6da615b5e /ifpps.c
parent382b08547cc61faf10d94cffef890ce0dc85609c (diff)
ifpps: correct calculation of line rate percentage
The line rate is given in Mbit rather than MiB (in which {rx,tx}_bytes were converted). Correct the calculation by converting {rx,tx}_bytes to Mbit: (n bytes * 8 bits per byte) / 1000^2 = (n bytes) / 125000 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'ifpps.c')
-rw-r--r--ifpps.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ifpps.c b/ifpps.c
index 3c9a6ea..0c24e7b 100644
--- a/ifpps.c
+++ b/ifpps.c
@@ -754,12 +754,12 @@ static void screen_net_dev_percentage(WINDOW *screen, const struct ifstat *rel,
mvwprintw(screen, (*voff)++, 0,
" rx: %15.2llf%% of line rate "
" ",
- rate ? ((((long double) rel->rx_bytes) / (1LLU << 20)) / rate) * 100.0 : 0.0);
+ rate ? ((((long double) rel->rx_bytes) / 125000) / 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);
+ rate ? ((((long double) rel->tx_bytes) / 125000) / rate) * 100.0 : 0.0);
}
static void screen_net_dev_abs(WINDOW *screen, const struct ifstat *abs,