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

phk at projects.linpro.no phk at projects.linpro.no
Thu Jul 10 10:09:15 CEST 2008


Author: phk
Date: 2008-07-10 10:09:15 +0200 (Thu, 10 Jul 2008)
New Revision: 2913

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vcl.c
   trunk/varnish-cache/include/stat_field.h
Log:
Add stats counters for tracking the number of vcls loaded.



Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vcl.c	2008-07-10 08:00:33 UTC (rev 2912)
+++ trunk/varnish-cache/bin/varnishd/cache_vcl.c	2008-07-10 08:09:15 UTC (rev 2913)
@@ -172,6 +172,8 @@
 	UNLOCK(&vcl_mtx);
 	cli_out(cli, "Loaded \"%s\" as \"%s\"\n", fn , name);
 	vcl->conf->init_func(cli);
+	VSL_stats->n_vcl++;
+	VSL_stats->n_vcl_avail++;
 	return (0);
 }
 
@@ -193,6 +195,8 @@
 	free(vcl->name);
 	(void)dlclose(vcl->dlh);
 	FREE_OBJ(vcl);
+	VSL_stats->n_vcl--;
+	VSL_stats->n_vcl_discard--;
 }
 
 /*--------------------------------------------------------------------*/
@@ -266,6 +270,8 @@
 		cli_out(cli, "VCL %s is the active VCL", av[2]);
 		return;
 	}
+	VSL_stats->n_vcl_discard++;
+	VSL_stats->n_vcl_avail--;
 	vcl->conf->discard = 1;
 	UNLOCK(&vcl_mtx);
 	if (vcl->conf->busy == 0)

Modified: trunk/varnish-cache/include/stat_field.h
===================================================================
--- trunk/varnish-cache/include/stat_field.h	2008-07-10 08:00:33 UTC (rev 2912)
+++ trunk/varnish-cache/include/stat_field.h	2008-07-10 08:09:15 UTC (rev 2913)
@@ -105,3 +105,7 @@
 MAC_STAT(sma_bfree,		uint64_t, 'i', "SMA bytes free")
 
 MAC_STAT(backend_req,		uint64_t, 'a', "Backend requests made")
+
+MAC_STAT(n_vcl,			uint64_t, 'a', "N vcl total")
+MAC_STAT(n_vcl_avail,		uint64_t, 'a', "N vcl available")
+MAC_STAT(n_vcl_discard,		uint64_t, 'a', "N vcl discarded")




More information about the varnish-commit mailing list