]> err.no Git - varnish/commitdiff
Add stats counters for tracking the number of vcls loaded.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 10 Jul 2008 08:09:15 +0000 (08:09 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 10 Jul 2008 08:09:15 +0000 (08:09 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2913 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_vcl.c
varnish-cache/include/stat_field.h

index 3c874881f117ce7f241748a0b19d337a547bf66a..a082f8f44058fb471bf3ae7075ecd0a3548af552 100644 (file)
@@ -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)
index 5a4bdea88a9787e30bc71210f38effa881d0d750..d3ea7e657e8e7710509ade9e2570f024819ea6ac 100644 (file)
@@ -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")