[master] 4dbf7e7 Move 3 bits more from diag_bitmaps to debug

Poul-Henning Kamp phk at varnish-cache.org
Mon Aug 27 20:58:51 CEST 2012


commit 4dbf7e7f2a5721a76b9b46a10cb5638c4972d0a1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 27 18:58:13 2012 +0000

    Move 3 bits more from diag_bitmaps to debug
    
    XXX: doc-update needed

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index f3e32c3..30f8e99 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1124,8 +1124,8 @@ DO_DEBUG(enum debug_bits x)
 	    (0x80U >> ((unsigned)x & 7)));
 }
 
-#define DSL(flag, tag, id, ...)					\
+#define DSL(debug_bit, id, ...)					\
 	do {							\
-		if (cache_param->diag_bitmap & (flag))		\
-			VSL((tag), (id), __VA_ARGS__);		\
+		if (DO_DEBUG(debug_bit))			\
+			VSL(SLT_Debug, (id), __VA_ARGS__);	\
 	} while (0)
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index e7fee9b..404409f 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -105,7 +105,7 @@ ved_include(struct req *preq, const char *src, const char *host)
 		i = CNT_Request(wrk, req);
 		if (i == 1)
 			break;
-		DSL(0x20, SLT_Debug, req->vsl->wid,
+		DSL(DBG_WAITINGLIST, req->vsl->wid,
 		    "loop waiting for ESI (%d)", i);
 		assert(i == 2);
 		AZ(req->wrk);
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 5e1b004..fcf447a 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -420,7 +420,7 @@ HSH_Lookup(struct req *req)
 			VTAILQ_INSERT_TAIL(&oh->waitinglist->list,
 			    req, w_list);
 		}
-		if (cache_param->diag_bitmap & 0x20)
+		if (DO_DEBUG(DBG_WAITINGLIST))
 			VSLb(req->vsl, SLT_Debug,
 				"on waiting list <%p>", oh);
 
@@ -483,7 +483,7 @@ hsh_rush(struct dstat *ds, struct objhead *oh)
 		ds->busy_wakeup++;
 		AZ(req->wrk);
 		VTAILQ_REMOVE(&wl->list, req, w_list);
-		DSL(0x20, SLT_Debug, req->vsl->wid, "off waiting list");
+		DSL(DBG_WAITINGLIST, req->vsl->wid, "off waiting list");
 		if (SES_ScheduleReq(req)) {
 			/*
 			 * We could not schedule the session, leave the
diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c
index d84e937..a5251ff 100644
--- a/bin/varnishd/cache/cache_ws.c
+++ b/bin/varnishd/cache/cache_ws.c
@@ -37,7 +37,7 @@ WS_Assert(const struct ws *ws)
 {
 
 	CHECK_OBJ_NOTNULL(ws, WS_MAGIC);
-	DSL(0x02, SLT_Debug, 0, "WS(%p = (%s, %p %u %u %u)",
+	DSL(DBG_WORKSPACE, 0, "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));
@@ -60,7 +60,7 @@ void
 WS_Init(struct ws *ws, const char *id, void *space, unsigned len)
 {
 
-	DSL(0x02, SLT_Debug, 0,
+	DSL(DBG_WORKSPACE, 0,
 	    "WS_Init(%p, \"%s\", %p, %u)", ws, id, space, len);
 	assert(space != NULL);
 	memset(ws, 0, sizeof *ws);
@@ -83,7 +83,7 @@ WS_Reset(struct ws *ws, char *p)
 {
 
 	WS_Assert(ws);
-	DSL(0x02, SLT_Debug, 0, "WS_Reset(%p, %p)", ws, p);
+	DSL(DBG_WORKSPACE, 0, "WS_Reset(%p, %p)", ws, p);
 	assert(ws->r == NULL);
 	if (p == NULL)
 		ws->f = ws->s;
@@ -111,7 +111,7 @@ WS_Alloc(struct ws *ws, unsigned bytes)
 	}
 	r = ws->f;
 	ws->f += bytes;
-	DSL(0x02, SLT_Debug, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r);
+	DSL(DBG_WORKSPACE, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r);
 	WS_Assert(ws);
 	return (r);
 }
@@ -122,7 +122,7 @@ WS_Snapshot(struct ws *ws)
 
 	WS_Assert(ws);
 	assert(ws->r == NULL);
-	DSL(0x02, SLT_Debug, 0, "WS_Snapshot(%p) = %p", ws, ws->f);
+	DSL(DBG_WORKSPACE, 0, "WS_Snapshot(%p) = %p", ws, ws->f);
 	return (ws->f);
 }
 
@@ -142,7 +142,7 @@ WS_Reserve(struct ws *ws, unsigned bytes)
 	b2 = PRNDDN(b2);
 	xxxassert(ws->f + b2 <= ws->e);
 	ws->r = ws->f + b2;
-	DSL(0x02, SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u",
+	DSL(DBG_WORKSPACE, 0, "WS_Reserve(%p, %u/%u) = %u",
 	    ws, b2, bytes, pdiff(ws->f, ws->r));
 	WS_Assert(ws);
 	return (pdiff(ws->f, ws->r));
@@ -154,7 +154,7 @@ WS_Release(struct ws *ws, unsigned bytes)
 	WS_Assert(ws);
 	bytes = PRNDUP(bytes);
 	assert(bytes <= ws->e - ws->f);
-	DSL(0x02, SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes);
+	DSL(DBG_WORKSPACE, 0, "WS_Release(%p, %u)", ws, bytes);
 	assert(ws->r != NULL);
 	assert(ws->f + bytes <= ws->r);
 	ws->f += bytes;
@@ -166,7 +166,7 @@ void
 WS_ReleaseP(struct ws *ws, char *ptr)
 {
 	WS_Assert(ws);
-	DSL(0x02, SLT_Debug, 0, "WS_ReleaseP(%p, %p)", ws, ptr);
+	DSL(DBG_WORKSPACE, 0, "WS_ReleaseP(%p, %p)", ws, ptr);
 	assert(ws->r != NULL);
 	assert(ptr >= ws->f);
 	assert(ptr <= ws->r);
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 7696292..dd084ed 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -1046,11 +1046,8 @@ static const struct parspec input_parspec[] = {
 		WAITER_DEFAULT, NULL },
 	{ "diag_bitmap", tweak_diag_bitmap, 0, 0, 0,
 		"Bitmap controlling diagnostics code:\n"
-		"  0x00000002 - workspace debugging.\n"
-		"  0x00000004 - kqueue debugging.\n"
 		"  0x00000008 - mutex logging.\n"
 		"  0x00000010 - mutex contests.\n"
-		"  0x00000020 - waiting list.\n"
 		"  0x00000040 - object workspace.\n"
 		"  0x00000080 - mutex timing.\n"
 		"  0x00001000 - do not core-dump child process.\n"
diff --git a/bin/varnishd/waiter/cache_waiter_kqueue.c b/bin/varnishd/waiter/cache_waiter_kqueue.c
index bc5c67f..8d37ad6 100644
--- a/bin/varnishd/waiter/cache_waiter_kqueue.c
+++ b/bin/varnishd/waiter/cache_waiter_kqueue.c
@@ -80,7 +80,7 @@ vwk_kq_sess(struct vwk *vwk, struct sess *sp, short arm)
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	assert(sp->fd >= 0);
-	DSL(0x04, SLT_Debug, sp->vxid, "KQ: EV_SET sp %p arm %x", sp, arm);
+	DSL(DBG_WAITER, sp->vxid, "KQ: EV_SET sp %p arm %x", sp, arm);
 	EV_SET(&vwk->ki[vwk->nki], sp->fd, EVFILT_READ, arm, 0, 0, sp);
 	if (++vwk->nki == NKEV)
 		vwk_kq_flush(vwk);
@@ -121,7 +121,7 @@ vwk_sess_ev(struct vwk *vwk, const struct kevent *kp, double now)
 	AN(kp->udata);
 	assert(kp->udata != vwk->pipes);
 	CAST_OBJ_NOTNULL(sp, kp->udata, SESS_MAGIC);
-	DSL(0x04, SLT_Debug, sp->vxid, "KQ: sp %p kev data %lu flags 0x%x%s",
+	DSL(DBG_WAITER, sp->vxid, "KQ: sp %p kev data %lu flags 0x%x%s",
 	    sp, (unsigned long)kp->data, kp->flags,
 	    (kp->flags & EV_EOF) ? " EOF" : "");
 
diff --git a/bin/varnishtest/tests/b00000.vtc b/bin/varnishtest/tests/b00000.vtc
index 2018235..2e6d5ce 100644
--- a/bin/varnishtest/tests/b00000.vtc
+++ b/bin/varnishtest/tests/b00000.vtc
@@ -7,7 +7,7 @@ server s1 {
 
 varnish v1 -storage "-smalloc,1m" -vcl+backend {} -start
 
-varnish v1 -cliok "param.set diag_bitmap 0x2"
+varnish v1 -cliok "param.set debug +workspace"
 
 varnish v1 -expect n_object == 0
 varnish v1 -expect sess_conn == 0
diff --git a/bin/varnishtest/tests/r00345.vtc b/bin/varnishtest/tests/r00345.vtc
index 712aa98..6ebbc99 100644
--- a/bin/varnishtest/tests/r00345.vtc
+++ b/bin/varnishtest/tests/r00345.vtc
@@ -9,7 +9,7 @@ server s1 {
 	txresp -body {DATA}
 } -start
 
-varnish v1 -arg "-p diag_bitmap=0x20" -vcl+backend {
+varnish v1 -arg "-p debug=+workspace" -vcl+backend {
 	sub vcl_fetch {
 		if (req.url == "/") {
 			set beresp.do_esi = true;
diff --git a/bin/varnishtest/tests/r00386.vtc b/bin/varnishtest/tests/r00386.vtc
index f5f1907..c2fcc53 100644
--- a/bin/varnishtest/tests/r00386.vtc
+++ b/bin/varnishtest/tests/r00386.vtc
@@ -9,7 +9,7 @@ server s1 {
 	txresp -body {<X><esi:include src="/body"/></X>}
 } -start
 
-varnish v1 -arg "-p diag_bitmap=0x20" -vcl+backend {
+varnish v1 -arg "-p debug=+workspace" -vcl+backend {
 	sub vcl_fetch {
 		if (req.url == "/") {
 			set beresp.do_esi = true;
diff --git a/include/tbl/debug_bits.h b/include/tbl/debug_bits.h
index 7acf6d8..3300547 100644
--- a/include/tbl/debug_bits.h
+++ b/include/tbl/debug_bits.h
@@ -29,4 +29,7 @@
  *
  */
 
-DEBUG_BIT(REQ_STATE,		req_state,	"",  "Request state engine")
+DEBUG_BIT(REQ_STATE,		req_state,	"",  "VSL Request state engine")
+DEBUG_BIT(WORKSPACE,		workspace,	"",  "VSL Workspace operations")
+DEBUG_BIT(WAITER,		waiter,		"",  "VSL Waiter internals")
+DEBUG_BIT(WAITINGLIST,		waitinglist,	"",  "VSL Waitinglist events")



More information about the varnish-commit mailing list