From: phk Date: Sat, 16 Sep 2006 07:44:15 +0000 (+0000) Subject: Make the shmlog'ing of vcl execution a parameter. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f654973e593bc47fe845a5673604be55a7e79f43;p=varnish Make the shmlog'ing of vcl execution a parameter. 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 --- diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index e969a736..86c24d9a 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -10,6 +10,7 @@ #include #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); } /*--------------------------------------------------------------------*/ diff --git a/varnish-cache/bin/varnishd/heritage.h b/varnish-cache/bin/varnishd/heritage.h index d16f172d..5f5a4911 100644 --- a/varnish-cache/bin/varnishd/heritage.h +++ b/varnish-cache/bin/varnishd/heritage.h @@ -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; diff --git a/varnish-cache/bin/varnishd/mgt_param.c b/varnish-cache/bin/varnishd/mgt_param.c index ff3879f1..298e1288 100644 --- a/varnish-cache/bin/varnishd/mgt_param.c +++ b/varnish-cache/bin/varnishd/mgt_param.c @@ -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 } };