From f2f445ae308087ed49cfc6fb0d224860915d8f50 Mon Sep 17 00:00:00 2001 From: phk Date: Thu, 10 Jul 2008 08:09:15 +0000 Subject: [PATCH] Add stats counters for tracking the number of vcls loaded. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2913 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_vcl.c | 6 ++++++ varnish-cache/include/stat_field.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache_vcl.c b/varnish-cache/bin/varnishd/cache_vcl.c index 3c874881..a082f8f4 100644 --- a/varnish-cache/bin/varnishd/cache_vcl.c +++ b/varnish-cache/bin/varnishd/cache_vcl.c @@ -172,6 +172,8 @@ VCL_Load(const char *fn, const char *name, struct cli *cli) 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 @@ VCL_Nuke(struct vcls *vcl) free(vcl->name); (void)dlclose(vcl->dlh); FREE_OBJ(vcl); + VSL_stats->n_vcl--; + VSL_stats->n_vcl_discard--; } /*--------------------------------------------------------------------*/ @@ -266,6 +270,8 @@ ccf_config_discard(struct cli *cli, const char * const *av, void *priv) 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) diff --git a/varnish-cache/include/stat_field.h b/varnish-cache/include/stat_field.h index 5a4bdea8..d3ea7e65 100644 --- a/varnish-cache/include/stat_field.h +++ b/varnish-cache/include/stat_field.h @@ -105,3 +105,7 @@ MAC_STAT(sma_balloc, uint64_t, 'i', "SMA bytes allocated") 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") -- 2.39.5