diff --git a/wmifs/wmifs/wmifs.c b/wmifs/wmifs/wmifs.c index 972321c..9f5374b 100644 --- a/wmifs/wmifs/wmifs.c +++ b/wmifs/wmifs/wmifs.c @@ -74,6 +74,9 @@ ---- Changes: --- + 01/08/2004 (Peter Samuelson, peter@samba-tng.org) + * Patch to make make sampling and scrolling intervals + customizable, adds new options -I and -s. 01/15/2002 (Matyas Koszik, koszik@debijan.lonyay.edu.hu) * Patch that fixes segfaults on long interface names. 08/31/2001 (Davi Leal, davileal@terra.es) @@ -183,6 +186,7 @@ #include #include #include +#include #include #include @@ -197,8 +201,11 @@ #include "wmifs-master.xpm" #include "wmifs-mask.xbm" -/* How often to check for new network interface, in seconds */ -#define CHECK_INTERFACE_INTERVAL 5 +/* How often to check for new network interface, in ms */ +#define CHECK_INTERFACE_INTERVAL 5000 + +/* How often to query the interfaces, in ms */ +#define DEFAULT_SAMPLE_INTERVAL 50 /***********/ /* Defines */ @@ -234,6 +241,8 @@ char *active_interface = NULL; int TimerDivisor=60; int WaveForm=0; int LockMode=0; +int SampleInt = DEFAULT_SAMPLE_INTERVAL; +int ScrollSpeed = CHECK_INTERFACE_INTERVAL; /*****************/ /* PPP variables */ @@ -296,9 +305,17 @@ int main(int argc, char *argv[]) { active_interface = argv[i+1]; i++; break; + case 'I' : + SampleInt = atof(argv[i+1]) * 1000; + i++; + break; case 'l' : LockMode = 1; break; + case 's' : + ScrollSpeed = atof(argv[i+1]) * 1000; + i++; + break; case 'v' : printversion(); exit(0); @@ -361,9 +378,9 @@ void wmifs_routine(int argc, char **argv) { int stat_online; int stat_current; - time_t starttime; - time_t curtime; - time_t nexttime; + unsigned int curtime; + unsigned int nexttime; + struct timeval tv, tv2; long ipacket, opacket, istat, ostat; @@ -410,8 +427,8 @@ void wmifs_routine(int argc, char **argv) { AddMouseRegion(0, 5, 5, 35, 15); AddMouseRegion(1, 5, 20, 58, 58); - starttime = time(0); - nexttime = starttime + CHECK_INTERFACE_INTERVAL; + gettimeofday(&tv2, NULL); + nexttime = ScrollSpeed; for (i=0; i= nexttime) { - - nexttime=curtime+CHECK_INTERFACE_INTERVAL; + nexttime=curtime+ScrollSpeed; for (i=0; i\n"); fprintf(stderr, "\t-h\tthis help screen\n"); fprintf(stderr, "\t-i \tdefault (as it appears in /proc/net/route)\n"); + fprintf(stderr, "\t-I \tsampling interval, in seconds (default: 0.05)\n"); fprintf(stderr, "\t-l\tstarts in lock mode\n"); + fprintf(stderr, "\t-s \tscrolling interval, in seconds (default: 5)\n"); fprintf(stderr, "\t-v\tprint the version number\n"); fprintf(stderr, "\t-w\twaveform load\n"); fprintf(stderr, "\n");