r3041 - trunk/varnish-cache/bin/varnishstat

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Jul 31 12:19:44 CEST 2008


Author: tfheen
Date: 2008-07-31 12:19:44 +0200 (Thu, 31 Jul 2008)
New Revision: 3041

Modified:
   trunk/varnish-cache/bin/varnishstat/varnishstat.c
Log:
Add uptime to varnishstat -1 output

Make varnishstat -1 also output the uptime.

Closes #68


Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c
===================================================================
--- trunk/varnish-cache/bin/varnishstat/varnishstat.c	2008-07-31 10:03:27 UTC (rev 3040)
+++ trunk/varnish-cache/bin/varnishstat/varnishstat.c	2008-07-31 10:19:44 UTC (rev 3041)
@@ -211,6 +211,13 @@
 	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 @@
 	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 @@
 {
 	int i, valid_field, field_length;
 	const char *all_fields[] = {
+	  "uptime",
 #define MAC_STAT(n, t, f, d) \
 	#n,
 #include "stat_field.h"




More information about the varnish-commit mailing list