sbm

simple bandwidth monitor
git clone git://git.2f30.org/sbm
Log | Files | Refs | LICENSE

commit 5241b7259dd364107c2542aaaaebfbf91041e773
parent 1ca82c18fc7a95002a59b8cda651cf1547e92c15
Author: sin <sin@2f30.org>
Date:   Sun, 31 Jul 2016 10:00:10 +0100

Group printing functions together

Diffstat:
Msbm.c | 32++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/sbm.c b/sbm.c @@ -185,6 +185,22 @@ print(uint64_t rxbits, uint64_t txbits, uint64_t rxpps, uint64_t txpps) fflush(stdout); } +void +printrxtx(int sig) +{ + char *rxsuffix, *txsuffix; + double rxround, txround; + uint64_t rxbits = (rxbytes - origrxbytes) * 8, + txbits = (txbytes - origtxbytes) * 8; + + rxround = scale(&rxsuffix, rxbits); + txround = scale(&txsuffix, txbits); + + printf("%*s %6.2f %2s Rx %6.2f %2s Tx\n", + (int)strlen(ifname) + 1, "", + rxround, rxsuffix, txround, txsuffix); +} + int getmonotime(struct timeval *tv) { @@ -256,22 +272,6 @@ loop(long count, struct timeval *delay) } void -printrxtx(int sig) -{ - char *rxsuffix, *txsuffix; - double rxround, txround; - uint64_t rxbits = (rxbytes - origrxbytes) * 8, - txbits = (txbytes - origtxbytes) * 8; - - rxround = scale(&rxsuffix, rxbits); - txround = scale(&txsuffix, txbits); - - printf("%*s %6.2f %2s Rx %6.2f %2s Tx\n", - (int)strlen(ifname) + 1, "", - rxround, rxsuffix, txround, txsuffix); -} - -void usage(void) { fprintf(stderr, "usage: %s [-B | -t] [-c count] [-d delay] [-i interface]\n", argv0);