r2218 - in branches/1.2: . bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Tue Oct 30 15:08:41 CET 2007


Author: des
Date: 2007-10-30 15:08:40 +0100 (Tue, 30 Oct 2007)
New Revision: 2218

Modified:
   branches/1.2/
   branches/1.2/autogen.des
   branches/1.2/bin/varnishd/cache_center.c
   branches/1.2/bin/varnishd/cache_ws.c
   branches/1.2/configure.ac
Log:
Merged revisions 2211-2213,2215 via svnmerge from 
svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache

........
  r2211 | des | 2007-10-30 14:39:21 +0100 (Tue, 30 Oct 2007) | 2 lines
  
  Add an --enable-diagnostics option which causes DIAGNOSTICS to be defined.
........
  r2212 | des | 2007-10-30 14:41:56 +0100 (Tue, 30 Oct 2007) | 2 lines
  
  Enable diagnostics
........
  r2213 | des | 2007-10-30 14:42:52 +0100 (Tue, 30 Oct 2007) | 2 lines
  
  Simplify WS_DEBUG(), and make it conditional on DIAGNOSTICS.
........
  r2215 | des | 2007-10-30 15:06:37 +0100 (Tue, 30 Oct 2007) | 3 lines
  
  When DIAGNOSTICS is defined, log every step that each session goes through,
  along with some vital statistics, and flush the log regularly.
........



Property changes on: branches/1.2
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210,2214
   + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215

Modified: branches/1.2/autogen.des
===================================================================
--- branches/1.2/autogen.des	2007-10-30 14:08:28 UTC (rev 2217)
+++ branches/1.2/autogen.des	2007-10-30 14:08:40 UTC (rev 2218)
@@ -15,6 +15,7 @@
     --enable-developer-warnings \
     --enable-debugging-symbols \
     --enable-dependency-tracking \
+    --enable-diagnostics \
     --enable-extra-developer-warnings \
     --enable-stack-protector \
     --enable-werror \

Modified: branches/1.2/bin/varnishd/cache_center.c
===================================================================
--- branches/1.2/bin/varnishd/cache_center.c	2007-10-30 14:08:28 UTC (rev 2217)
+++ branches/1.2/bin/varnishd/cache_center.c	2007-10-30 14:08:40 UTC (rev 2218)
@@ -866,7 +866,21 @@
 		CHECK_OBJ_ORNULL(sp->backend, BACKEND_MAGIC);
 
 		switch (sp->step) {
-#define STEP(l,u) case STP_##u: done = cnt_##l(sp); break;
+#ifdef DIAGNOSTICS
+#define STEP(l,u) \
+		    case STP_##u: \
+			WSL(sp->wrk, SLT_Debug, sp->id, \
+			    "cnt_%s(%p) xid %x obj %p vcl %p", \
+			    #l, sp, sp->xid, sp->obj, sp->vcl);	\
+			WSL_Flush(sp->wrk); \
+			done = cnt_##l(sp); \
+			break;
+#else
+#define STEP(l,u) \
+		    case STP_##u: \
+			done = cnt_##l(sp); \
+		        break;
+#endif
 #include "steps.h"
 #undef STEP
 		default:	INCOMPL();

Modified: branches/1.2/bin/varnishd/cache_ws.c
===================================================================
--- branches/1.2/bin/varnishd/cache_ws.c	2007-10-30 14:08:28 UTC (rev 2217)
+++ branches/1.2/bin/varnishd/cache_ws.c	2007-10-30 14:08:40 UTC (rev 2218)
@@ -46,10 +46,10 @@
 #include "cache.h"
 
 /* Enable this to get detailed logging of WS usage */
-#if 0
-#  define WS_DEBUG(foo)	VSL foo
+#ifdef DIAGNOSTICS
+#  define WS_DEBUG(fmt, ...)	VSL(SLT_Debug, 0, fmt, __VA_ARGS__)
 #else
-#  define WS_DEBUG(foo)	/* nothing */
+#  define WS_DEBUG(fmt, ...)	/* nothing */
 #endif
 
 void
@@ -57,10 +57,10 @@
 {
 
 	CHECK_OBJ_NOTNULL(ws, WS_MAGIC);
-	WS_DEBUG((SLT_Debug, 0, "WS(%p = (%s, %p %u %u %u)",
+	WS_DEBUG("WS(%p = (%s, %p %u %u %u)",
 	    ws, ws->id, ws->s, pdiff(ws->s, ws->f),
 	    ws->r == NULL ? 0 : pdiff(ws->f, ws->r),
-	    pdiff(ws->s, ws->e)));
+	    pdiff(ws->s, ws->e));
 	assert(ws->s != NULL);
 	assert(ws->e != NULL);
 	assert(ws->s < ws->e);
@@ -76,7 +76,7 @@
 WS_Init(struct ws *ws, const char *id, void *space, unsigned len)
 {
 
-	WS_DEBUG((SLT_Debug, 0, "WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len));
+	WS_DEBUG("WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len);
 	assert(space != NULL);
 	memset(ws, 0, sizeof *ws);
 	ws->magic = WS_MAGIC;
@@ -92,7 +92,7 @@
 {
 
 	WS_Assert(ws);
-	WS_DEBUG((SLT_Debug, 0, "WS_Reset(%p, %p)", ws, p));
+	WS_DEBUG("WS_Reset(%p, %p)", ws, p);
 	assert(ws->r == NULL);
 	if (p == NULL)
 		ws->f = ws->s;
@@ -114,7 +114,7 @@
 		return(NULL);
 	r = ws->f;
 	ws->f += bytes;
-	WS_DEBUG((SLT_Debug, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r));
+	WS_DEBUG("WS_Alloc(%p, %u) = %p", ws, bytes, r);
 	return (r);
 }
 
@@ -128,7 +128,7 @@
 	p = WS_Alloc(ws, l);
 	if (p != NULL)
 		memcpy(p, s, l);
-	WS_DEBUG((SLT_Debug, 0, "WS_Dup(%p, \"%s\") = %p", ws, s, p));
+	WS_DEBUG("WS_Dup(%p, \"%s\") = %p", ws, s, p);
 	return (p);
 }
 
@@ -138,7 +138,7 @@
 
 	WS_Assert(ws);
 	assert(ws->r == NULL);
-	WS_DEBUG((SLT_Debug, 0, "WS_Snapshot(%p) = %p", ws, ws->f));
+	WS_DEBUG("WS_Snapshot(%p) = %p", ws, ws->f);
 	return (ws->f);
 }
 
@@ -153,8 +153,8 @@
 		b2 = ws->e - ws->f;
 	xxxassert(ws->f + b2 <= ws->e);
 	ws->r = ws->f + b2;
-	WS_DEBUG((SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u",
-	    ws, b2, bytes, pdiff(ws->f, ws->r)));
+	WS_DEBUG("WS_Reserve(%p, %u/%u) = %u",
+	    ws, b2, bytes, pdiff(ws->f, ws->r));
 	return (pdiff(ws->f, ws->r));
 }
 
@@ -162,7 +162,7 @@
 WS_Release(struct ws *ws, unsigned bytes)
 {
 	WS_Assert(ws);
-	WS_DEBUG((SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes));
+	WS_DEBUG("WS_Release(%p, %u)", ws, bytes);
 	assert(ws->r != NULL);
 	assert(ws->f + bytes <= ws->r);
 	ws->f += bytes;
@@ -173,7 +173,7 @@
 WS_ReleaseP(struct ws *ws, char *ptr)
 {
 	WS_Assert(ws);
-	WS_DEBUG((SLT_Debug, 0, "WS_ReleaseP(%p, %p)", ws, ptr));
+	WS_DEBUG("WS_ReleaseP(%p, %p)", ws, ptr);
 	assert(ws->r != NULL);
 	assert(ptr >= ws->f);
 	assert(ptr <= ws->r);

Modified: branches/1.2/configure.ac
===================================================================
--- branches/1.2/configure.ac	2007-10-30 14:08:28 UTC (rev 2217)
+++ branches/1.2/configure.ac	2007-10-30 14:08:40 UTC (rev 2218)
@@ -134,6 +134,9 @@
 AC_ARG_ENABLE(debugging-symbols,
 	AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]),
 	CFLAGS="${CFLAGS} -O0 -g -fno-inline")
+AC_ARG_ENABLE(diagnostics,
+	AS_HELP_STRING([--enable-diagnostics],[enable run-time diagnostics (default is NO)]),
+	CFLAGS="${CFLAGS} -DDIAGNOSTICS")
 AC_ARG_ENABLE(extra-developer-warnings,
 	AS_HELP_STRING([--enable-extra-developer-warnings],[enable even stricter warnings (default is NO)]),
 	CFLAGS="${CFLAGS} ${EXTRA_DEVELOPER_CFLAGS}")




More information about the varnish-commit mailing list