]> err.no Git - varnish/commitdiff
Make the shmlog'ing of vcl execution a parameter.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 16 Sep 2006 07:44:15 +0000 (07:44 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 16 Sep 2006 07:44:15 +0000 (07:44 +0000)
VCL tracing is responsible for a very large fraction of the shmlog
records and will generally only be used for debugging of VCL code.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@997 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_vrt.c
varnish-cache/bin/varnishd/heritage.h
varnish-cache/bin/varnishd/mgt_param.c

index e969a736805e1c7707f1843f740701f3c858d5ba..86c24d9a062612d3395b331ab2bc5e5bc1d2ce1e 100644 (file)
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 
 #include "shmlog.h"
+#include "heritage.h"
 #include "vrt.h"
 #include "vrt_obj.h"
 #include "vcl.h"
@@ -34,9 +35,9 @@ VRT_count(struct sess *sp, unsigned u)
 {
        
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-       VSL(SLT_VCL_trace, sp->fd, "%u %d.%d", u,
-           sp->vcl->ref[u].line,
-           sp->vcl->ref[u].pos);
+       if (params->vcl_trace)
+               VSL(SLT_VCL_trace, sp->fd, "%u %d.%d", u,
+                   sp->vcl->ref[u].line, sp->vcl->ref[u].pos);
 }
 
 /*--------------------------------------------------------------------*/
index d16f172d0e864d3664745b72763bdd1f86c6fd89..5f5a4911a555dca9c2fd9d5fff8008f91f7c113f 100644 (file)
@@ -54,8 +54,8 @@ struct params {
        /* Sendfile object minimum size */
        unsigned                sendfile_threshold;
 
-       /* Session dispostion grace period */
-       unsigned                session_grace;
+       /* VCL traces */
+       unsigned                vcl_trace;
 };
 
 extern struct params *params;
index ff3879f12e64dc456369fe04fb55ffd3735851cc..298e12884321736a7f9888e4d7937f09ac5a79a4 100644 (file)
@@ -226,6 +226,34 @@ tweak_sendfile_threshold(struct cli *cli, struct parspec *par, const char *arg)
 
 /*--------------------------------------------------------------------*/
 
+static void
+tweak_vcl_trace(struct cli *cli, struct parspec *par, const char *arg)
+{
+       (void)par;
+       if (arg != NULL) {
+               if (!strcasecmp(arg, "off"))
+                       params->vcl_trace = 0;
+               else if (!strcasecmp(arg, "disable"))
+                       params->vcl_trace = 0;
+               else if (!strcasecmp(arg, "no"))
+                       params->vcl_trace = 0;
+               else if (!strcasecmp(arg, "on"))
+                       params->vcl_trace = 1;
+               else if (!strcasecmp(arg, "enable"))
+                       params->vcl_trace = 1;
+               else if (!strcasecmp(arg, "yes"))
+                       params->vcl_trace = 1;
+               else {
+                       cli_out(cli, "use \"on\" or \"off\"\n");
+                       cli_result(cli, CLIS_PARAM);
+                       return;
+               }
+       }
+       cli_out(cli, params->vcl_trace ? "on" : "off");
+}
+
+/*--------------------------------------------------------------------*/
+
 /*
  * Make sure to end all lines with either a space or newline of the
  * formatting will go haywire.
@@ -301,6 +329,9 @@ static struct parspec parspec[] = {
                "The minimum size of objects transmitted with sendfile.\n"
                "Default is 8192 bytes.", "8192" },
 #endif /* HAVE_SENDFILE */
+       { "vcl_trace", tweak_vcl_trace,
+               "Trace VCL execution in the shmlog\n"
+               "Default is off", "off" },
        { NULL, NULL, NULL }
 };