Mailing List Archive

r997 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2006-09-16 09:44:15 +0200 (Sat, 16 Sep 2006)
New Revision: 997

Modified:
trunk/varnish-cache/bin/varnishd/cache_vrt.c
trunk/varnish-cache/bin/varnishd/heritage.h
trunk/varnish-cache/bin/varnishd/mgt_param.c
Log:
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.



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-09-15 19:25:06 UTC (rev 996)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2006-09-16 07:44:15 UTC (rev 997)
@@ -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 @@
{

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);
}

/*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/bin/varnishd/heritage.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/heritage.h 2006-09-15 19:25:06 UTC (rev 996)
+++ trunk/varnish-cache/bin/varnishd/heritage.h 2006-09-16 07:44:15 UTC (rev 997)
@@ -54,8 +54,8 @@
/* Sendfile object minimum size */
unsigned sendfile_threshold;

- /* Session dispostion grace period */
- unsigned session_grace;
+ /* VCL traces */
+ unsigned vcl_trace;
};

extern struct params *params;

Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-09-15 19:25:06 UTC (rev 996)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-09-16 07:44:15 UTC (rev 997)
@@ -226,6 +226,34 @@

/*--------------------------------------------------------------------*/

+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 @@
"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 }
};