sbm

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

commit cbb4d1e9b2806ab7521fb35b1d8533fee02cb8d3
parent c0be38706db5461be5147c303a89393b2c977010
Author: sin <sin@2f30.org>
Date:   Mon Feb 22 15:32:21 +0000

Add some clarification around sampling rate

Diffstat:
sbm.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sbm.c b/sbm.c @@ -40,6 +40,8 @@ #include "arg.h" +#define SAMPLINGRATE (100) /* sampling rate in ms */ + char *argv0; void @@ -225,7 +227,11 @@ loop(char *ifname, long count, struct timeval *delay) getmonotime(&old); sample(ifname, &oldrxbytes, &oldtxbytes, &oldrxpps, &oldtxpps); for (;;) { - usleep(100000); /* sleep for 100 ms */ + /* + * This is the maximum sampling rate that is supported and + * is always less or equal to the given delay. + */ + usleep(SAMPLINGRATE * 1000); sample(ifname, &rxbytes, &txbytes, &rxpps, &txpps); getmonotime(&now); timersub(&now, &old, &diff);