[experimental-ims] bc1d749 Shave acct_req down to a bodybytes counter, it's all we use it for.

Geoff Simmons geoff at varnish-cache.org
Mon Jan 9 21:51:57 CET 2012


commit bc1d749a6618aecc2c075ce30e1366fa71c525da
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 19 09:45:00 2011 +0000

    Shave acct_req down to a bodybytes counter, it's all we use it for.
    
    Make pipe mode use the acct_tmp like everybody else.

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 4f18a08..6c80714 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -218,9 +218,9 @@ struct acct {
 
 /*--------------------------------------------------------------------*/
 
-#define L0(n)
-#define L1(n)			uint64_t n;
-#define VSC_F(n, t, l, f, e,d)	L##l(n)
+#define L0(t, n)
+#define L1(t, n)		t n;
+#define VSC_F(n, t, l, f, e,d)	L##l(t, n)
 #define VSC_DO_MAIN
 struct dstat {
 #include "vsc_fields.h"
@@ -615,7 +615,7 @@ struct sess {
 	struct sessmem		*mem;
 
 	VTAILQ_ENTRY(sess)	poollist;
-	struct acct		acct_req;
+	uint64_t		req_bodybytes;
 	struct acct		acct_ses;
 
 #if defined(HAVE_EPOLL_CTL)
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 122bccf..32a4215 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -338,7 +338,8 @@ cnt_done(struct sess *sp)
 		/* XXX: Add StatReq == StatSess */
 		/* XXX: Workaround for pipe */
 		if (sp->fd >= 0) {
-			WSP(sp, SLT_Length, "%ju", (uintmax_t)sp->acct_req.bodybytes);
+			WSP(sp, SLT_Length, "%ju",
+			    (uintmax_t)sp->req_bodybytes);
 		}
 		WSL(sp->wrk, SLT_ReqEnd, sp->id, "%u %.9f %.9f %.9f %.9f %.9f",
 		    sp->xid, sp->t_req, sp->t_end, dh, dp, da);
@@ -352,7 +353,7 @@ cnt_done(struct sess *sp)
 	if (sp->esi_level > 0)
 		return (1);
 
-	memset(&sp->acct_req, 0, sizeof sp->acct_req);
+	sp->req_bodybytes = 0;
 
 	sp->t_req = NAN;
 	sp->hash_always_miss = 0;
diff --git a/bin/varnishd/cache_pipe.c b/bin/varnishd/cache_pipe.c
index ddb5c15..3968767 100644
--- a/bin/varnishd/cache_pipe.c
+++ b/bin/varnishd/cache_pipe.c
@@ -78,10 +78,10 @@ PipeSession(struct sess *sp)
 	(void)VTCP_blocking(vc->fd);
 
 	WRW_Reserve(w, &vc->fd);
-	sp->acct_req.hdrbytes += http_Write(w, sp->wrk->bereq, 0);
+	sp->wrk->acct_tmp.hdrbytes += http_Write(w, sp->wrk->bereq, 0);
 
 	if (sp->htc->pipeline.b != NULL)
-		sp->acct_req.bodybytes +=
+		sp->wrk->acct_tmp.bodybytes +=
 		    WRW_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline));
 
 	i = WRW_FlushRelease(w);
diff --git a/bin/varnishd/cache_session.c b/bin/varnishd/cache_session.c
index e8352f6..bbc5706 100644
--- a/bin/varnishd/cache_session.c
+++ b/bin/varnishd/cache_session.c
@@ -80,9 +80,10 @@ SES_Charge(struct sess *sp)
 {
 	struct acct *a = &sp->wrk->acct_tmp;
 
+	sp->req_bodybytes += a->bodybytes;
+
 #define ACCT(foo)				\
 	sp->wrk->stats.s_##foo += a->foo;	\
-	sp->acct_req.foo += a->foo;		\
 	sp->acct_ses.foo += a->foo;		\
 	a->foo = 0;
 #include "acct_fields.h"



More information about the varnish-commit mailing list