]> err.no Git - varnish/commitdiff
Add a -w option to set the delay between updates.
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 18 Sep 2006 09:22:56 +0000 (09:22 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 18 Sep 2006 09:22:56 +0000 (09:22 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1065 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishstat/varnishstat.1
varnish-cache/bin/varnishstat/varnishstat.c

index 07c5ae559aabf67ec03ee587386e61faccb824d6..f58d400356e195b403094da05e71593c5df8ac94 100644 (file)
@@ -11,6 +11,7 @@
 .Nm
 .Op Fl 1
 .Op Fl V
+.Op Fl w Ar delay
 .Sh DESCRIPTION
 The
 .Nm
@@ -25,6 +26,11 @@ Instead of presenting of a continuously updated display, print the
 statistics once and exit.
 .It Fl V
 Display the version number and exit.
+.It Fl w Ar delay
+Wait
+.Ar delay
+seconds between updates.
+The default is 1.
 .El
 .Pp
 The columns in the main display are, from left to right:
@@ -32,7 +38,7 @@ The columns in the main display are, from left to right:
 .It
 Total since startup
 .It
-Delta since last update (normally the last second)
+Delta since last update
 .It
 Average over process lifetime
 .It
index d327ca8d625261923c1bd09b73c5efbe37d9634d..2e2bdf766fa5a709fddf86f6076589c7900cddf4 100644 (file)
@@ -26,7 +26,7 @@ myexp(double *acc, double val, unsigned *n, unsigned nmax)
 }
 
 static void
-do_curses(struct varnish_stats *VSL_stats)
+do_curses(struct varnish_stats *VSL_stats, int delay)
 {
        struct varnish_stats copy;
        intmax_t ju;
@@ -92,14 +92,14 @@ do_curses(struct varnish_stats *VSL_stats)
 #undef MAC_STAT
                lt = tt;
                refresh();
-               sleep(1);
+               sleep(delay);
        }
 }
 
 static void
 usage(void)
 {
-       fprintf(stderr, "usage: varnishstat [-1V]\n");
+       fprintf(stderr, "usage: varnishstat [-1V] [-w delay]\n");
        exit(1);
 }
 
@@ -108,11 +108,11 @@ main(int argc, char **argv)
 {
        int c;
        struct varnish_stats *VSL_stats;
-       int once = 0;
+       int delay = 1, once = 0;
 
        VSL_stats = VSL_OpenStats();
 
-       while ((c = getopt(argc, argv, "1V")) != -1) {
+       while ((c = getopt(argc, argv, "1Vw:")) != -1) {
                switch (c) {
                case '1':
                        once = 1;
@@ -120,13 +120,16 @@ main(int argc, char **argv)
                case 'V':
                        varnish_version("varnishstat");
                        exit(0);
+               case 'w':
+                       delay = atoi(optarg);
+                       break;
                default:
                        usage();
                }
        }
 
        if (!once) {
-               do_curses(VSL_stats);
+               do_curses(VSL_stats, delay);
        } else {
 
 #define MAC_STAT(n,t,f,d) \