sbm

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

commit dc8458f91696f8f808e1537efde130976d47a439
parent 71c5d0e7e7aaf460b8d56df47fe38528757b414d
Author: sin <sin@2f30.org>
Date:   Mon, 22 Feb 2016 14:45:32 +0000

Save one level of indentation

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

diff --git a/sbm.c b/sbm.c @@ -229,20 +229,20 @@ loop(char *ifname, long count, struct timeval *delay) sample(ifname, &rxbytes, &txbytes, &rxpps, &txpps); clock_gettime_tv(CLOCK_MONOTONIC, &now); timersub(&now, &old, &diff); - if (timercmp(&diff, delay, >=)) { - clock_gettime_tv(CLOCK_MONOTONIC, &old); - diffrxbits = (rxbytes - oldrxbytes) * 8; - difftxbits = (txbytes - oldtxbytes) * 8; - diffrxbits = diffrxbits * 1000 / tv2ms(&diff); - difftxbits = difftxbits * 1000 / tv2ms(&diff); - diffrxpps = (rxpps - oldrxpps) * 1000 / tv2ms(&diff); - difftxpps = (txpps - oldtxpps) * 1000 / tv2ms(&diff); - print(ifname, diffrxbits, difftxbits, diffrxpps, difftxpps); - oldrxbytes = rxbytes, oldtxbytes = txbytes; - oldrxpps = rxpps, oldtxpps = txpps; - if (count && ++n >= count) - break; - } + if (timercmp(&diff, delay, <)) + continue; + clock_gettime_tv(CLOCK_MONOTONIC, &old); + diffrxbits = (rxbytes - oldrxbytes) * 8; + difftxbits = (txbytes - oldtxbytes) * 8; + diffrxbits = diffrxbits * 1000 / tv2ms(&diff); + difftxbits = difftxbits * 1000 / tv2ms(&diff); + diffrxpps = (rxpps - oldrxpps) * 1000 / tv2ms(&diff); + difftxpps = (txpps - oldtxpps) * 1000 / tv2ms(&diff); + print(ifname, diffrxbits, difftxbits, diffrxpps, difftxpps); + oldrxbytes = rxbytes, oldtxbytes = txbytes; + oldrxpps = rxpps, oldtxpps = txpps; + if (count && ++n >= count) + break; } }