]> err.no Git - varnish/commitdiff
Add uptime to varnishstat -1 output
authortfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 31 Jul 2008 10:19:44 +0000 (10:19 +0000)
committertfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 31 Jul 2008 10:19:44 +0000 (10:19 +0000)
Make varnishstat -1 also output the uptime.

Closes #68

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3041 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishstat/varnishstat.c

index e9223131e6aa2db4bce69af530f66af46f6be746..58cd5d14703af3c0f9c7124074d6b1ee4c387b99 100644 (file)
@@ -211,6 +211,13 @@ do_once(struct varnish_stats *VSL_stats, const char* fields)
        gettimeofday(&tv, NULL);
        up = tv.tv_sec - VSL_stats->start_time;
 
+       do {
+         if (fields != NULL && ! show_field("uptime", fields ))
+           break;
+         printf("%-16s %12ju %12s %s\n", "uptime",
+                tv.tv_sec - VSL_stats->start_time, ".  ", "Child uptime");
+       } while (0);
+
 #define MAC_STAT(n, t, f, d) \
        do { \
                if (fields != NULL && ! show_field( #n, fields )) break; \
@@ -246,6 +253,8 @@ list_fields(void)
        fprintf(stderr, "Available fields to use with the varnishstat -f option:\n");
        fprintf(stderr, "Field name           Description\n");
        fprintf(stderr, "----------           -----------\n");
+       fprintf(stderr, "uptime               Child uptime\n");
+
 #define MAC_STAT(n, t, f, d) \
        do { \
                fprintf(stderr, "%-20s %s\n", #n, d);\
@@ -259,6 +268,7 @@ valid_fields(const char* fields)
 {
        int i, valid_field, field_length;
        const char *all_fields[] = {
+         "uptime",
 #define MAC_STAT(n, t, f, d) \
        #n,
 #include "stat_field.h"