[master] 2f057a3 Report VFP statistics in their own suppressed SLT_VfpAcct until we know what we really want with them.

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 15 09:59:04 CEST 2014


commit 2f057a329074d281b6031c413a0d1a044fc54840
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 15 07:58:27 2014 +0000

    Report VFP statistics in their own suppressed SLT_VfpAcct until we know
    what we really want with them.

diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c
index bec9225..9cf0aa4 100644
--- a/bin/varnishd/cache/cache_fetch_proc.c
+++ b/bin/varnishd/cache/cache_fetch_proc.c
@@ -118,9 +118,12 @@ VFP_Close(struct vfp_ctx *vc)
 {
 	struct vfp_entry *vfe;
 
-	VTAILQ_FOREACH(vfe, &vc->vfp, list)
+	VTAILQ_FOREACH(vfe, &vc->vfp, list) {
 		if(vfe->vfp->fini != NULL)
 			vfe->vfp->fini(vc, vfe);
+		VSLb(vc->vsl, SLT_VfpAcct, "%s %ju %ju",
+			vfe->vfp->name, vfe->calls, vfe->bytes_out);
+	}
 }
 
 int
@@ -131,6 +134,7 @@ VFP_Open(struct vfp_ctx *vc)
 	CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(vc->http, HTTP_MAGIC);
 	AN(vc->vsl);
+
 	VTAILQ_FOREACH_REVERSE(vfe, &vc->vfp, vfp_entry_s, list) {
 		if (vfe->vfp->init == NULL)
 			continue;
@@ -142,6 +146,7 @@ VFP_Open(struct vfp_ctx *vc)
 			return (-1);
 		}
 	}
+
 	return (0);
 }
 
@@ -175,13 +180,13 @@ VFP_Suck(struct vfp_ctx *vc, void *p, ssize_t *lp)
 			vp = VFP_ERROR;
 		}
 		vfe->closed = vp;
+		vfe->calls++;
+		vfe->bytes_out += *lp;
 	} else {
 		/* Already closed filter */
 		*lp = 0;
 		vp = vfe->closed;
 	}
-	vfe->calls++;
-	vfe->bytes_out = *lp;
 	vc->vfp_nxt = vfe;
 	return (vp);
 }
diff --git a/bin/varnishd/mgt/mgt_param_bits.c b/bin/varnishd/mgt/mgt_param_bits.c
index 270ed1f..32a4593 100644
--- a/bin/varnishd/mgt/mgt_param_bits.c
+++ b/bin/varnishd/mgt/mgt_param_bits.c
@@ -130,6 +130,7 @@ tweak_vsl_mask(struct vsb *vsb, const struct parspec *par, const char *arg)
 			(void)bit(mgt_param.vsl_mask, SLT_VCL_trace, BSET);
 			(void)bit(mgt_param.vsl_mask, SLT_WorkThread, BSET);
 			(void)bit(mgt_param.vsl_mask, SLT_Hash, BSET);
+			(void)bit(mgt_param.vsl_mask, SLT_VfpAcct, BSET);
 		} else {
 			return (bit_tweak(vsb, mgt_param.vsl_mask,
 			    SLT__Reserved, arg, VSL_tags,
diff --git a/bin/varnishtest/tests/g00002.vtc b/bin/varnishtest/tests/g00002.vtc
index 6c1597c..1418212 100644
--- a/bin/varnishtest/tests/g00002.vtc
+++ b/bin/varnishtest/tests/g00002.vtc
@@ -23,6 +23,7 @@ varnish v1 \
 } -start
 
 varnish v1 -cliok "param.set fetch_chunksize 4k"
+varnish v1 -cliok "param.set vsl_mask +VfpAcct"
 
 client c1 {
 	txreq -url /foo -hdr "Accept-Encoding: gzip"
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index 18b93f8..0fc3b86 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -499,4 +499,16 @@ SLTM(BereqAcct, 0, "Backend request accounting",
 	"\n"
 )
 
+SLTM(VfpAcct, 0, "Fetch filter accounting",
+	"Contains name of VFP and statistics.\n\n"
+	"The format is::\n\n"
+	"\t%s %d %d\n"
+	"\t|  |  |\n"
+	"\t|  |  +- Total bytes produced\n"
+	"\t|  +---- Number of calls made\n"
+	"\t+------- Name of filter\n"
+	"\n"
+	NODEF_NOTICE
+)
+
 #undef NODEF_NOTICE



More information about the varnish-commit mailing list