r4519 - in trunk/varnish-cache: bin/varnishd include

phk at projects.linpro.no phk at projects.linpro.no
Mon Feb 1 13:44:08 CET 2010


Author: phk
Date: 2010-02-01 13:44:07 +0100 (Mon, 01 Feb 2010)
New Revision: 4519

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/include/stat_field.h
Log:
Add a varnish "uptime" counter, which counts seconds of uptime for
the worker thread.



Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2010-02-01 12:40:44 UTC (rev 4518)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2010-02-01 12:44:07 UTC (rev 4519)
@@ -187,7 +187,7 @@
 	struct pollfd *pfd;
 	struct listen_sock *ls;
 	unsigned u;
-	double now, pace;
+	double t0, now, pace;
 
 	THR_SetName("cache-acceptor");
 	(void)arg;
@@ -208,6 +208,7 @@
 
 	need_test = 1;
 	pace = 0;
+	t0 = TIM_real();
 	while (1) {
 #ifdef SO_SNDTIMEO_WORKS
 		if (params->send_timeout != tv_sndtimeo.tv_sec) {
@@ -244,6 +245,7 @@
 			TIM_sleep(pace);
 		i = poll(pfd, heritage.nsocks, 1000);
 		now = TIM_real();
+		VSL_stats->uptime = (uint64_t)(now - t0);
 		u = 0;
 		VTAILQ_FOREACH(ls, &heritage.socks, list) {
 			if (ls->sock < 0)

Modified: trunk/varnish-cache/include/stat_field.h
===================================================================
--- trunk/varnish-cache/include/stat_field.h	2010-02-01 12:40:44 UTC (rev 4518)
+++ trunk/varnish-cache/include/stat_field.h	2010-02-01 12:44:07 UTC (rev 4519)
@@ -151,3 +151,4 @@
 MAC_STAT(esi_errors,		uint64_t, 0, 'a', "ESI parse errors (unlock)")
 MAC_STAT(accept_fail,		uint64_t, 0, 'a', "Accept failures")
 MAC_STAT(client_drop_late,	uint64_t, 0, 'a', "Connection dropped late")
+MAC_STAT(uptime,		uint64_t, 0, 'a', "Client uptime")



More information about the varnish-commit mailing list