[PATCH 13/25] Streaming statistics

Martin Blix Grydeland martin at varnish-software.com
Sun Jan 22 18:53:19 CET 2012


---
 bin/varnishd/cache/cache_center.c |    7 ++++++-
 include/tbl/acct_fields.h         |    1 +
 include/tbl/vsc_f_main.h          |    3 +++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 1f1a239..7a9134e 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -983,6 +983,9 @@ cnt_streambody_task(struct worker *wrk, void *priv)
 	objcore = obj->objcore;
 
 	wrk->busyobj->fetch_failed = FetchBody(wrk, wrk->busyobj);
+
+	wrk->stats.fetch_threaded++;
+
 	AZ(wrk->busyobj->fetch_obj);
 	AZ(wrk->busyobj->vbc);
 	wrk->busyobj->vfp = NULL;
@@ -1028,6 +1031,7 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
 	 * fetch at all. This code now assumes all passes through here
 	 * needs to do the fetch as well. (Multiple streaming clients
 	 * not implemented yet) */
+	wrk->acct_tmp.fetch++;
 	AZ(wrk->busyobj->fetch_obj);
 	wrk->busyobj->fetch_obj = req->obj;
 	http_Setup(wrk->busyobj->bereq, NULL);
@@ -1051,6 +1055,7 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
 			 * streaming. (MBGXXX: Flipflop not finished
 			 * yet) */
 			wrk->busyobj->do_stream_flipflop = 1;
+			wrk->stats.fetch_flipflop++;
 		}
 		wrk->busyobj->fetch_failed = FetchBody(sp->wrk, wrk->busyobj);
 		VBO_StreamStopped(wrk->busyobj);
@@ -1072,11 +1077,11 @@ cnt_streambody(struct sess *sp, struct worker *wrk, struct req *req)
 		AN(req->obj->objcore->ban);
 		HSH_Unbusy(wrk);
 	}
-	wrk->acct_tmp.fetch++;
 	req->director = NULL;
 	req->restarts = 0;
 
 	RES_StreamEnd(sp);
+	wrk->acct_tmp.streamed++;
 	if (wrk->res_mode & RES_GUNZIP)
 		(void)VGZ_Destroy(&sctx.vgz, sp->vsl_id);
 
diff --git a/include/tbl/acct_fields.h b/include/tbl/acct_fields.h
index 154f106..c58bcb1 100644
--- a/include/tbl/acct_fields.h
+++ b/include/tbl/acct_fields.h
@@ -38,3 +38,4 @@ ACCT(pass)
 ACCT(fetch)
 ACCT(hdrbytes)
 ACCT(bodybytes)
+ACCT(streamed)
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
index b6b8dc9..5761c51 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
@@ -143,6 +143,8 @@ VSC_F(fetch_failed,		uint64_t, 1, 'a', "Fetch failed", "")
 VSC_F(fetch_1xx,		uint64_t, 1, 'a', "Fetch no body (1xx)", "")
 VSC_F(fetch_204,		uint64_t, 1, 'a', "Fetch no body (204)", "")
 VSC_F(fetch_304,		uint64_t, 1, 'a', "Fetch no body (304)", "")
+VSC_F(fetch_threaded,		uint64_t, 1, 'a', "Fetch threaded", "")
+VSC_F(fetch_flipflop,		uint64_t, 1, 'a', "Fetch flipflop", "")
 
 /*---------------------------------------------------------------------
  * Pools, threads, and sessions
@@ -266,6 +268,7 @@ VSC_F(s_req,			uint64_t, 1, 'a', "Total Requests", "")
 VSC_F(s_pipe,			uint64_t, 1, 'a', "Total pipe", "")
 VSC_F(s_pass,			uint64_t, 1, 'a', "Total pass", "")
 VSC_F(s_fetch,			uint64_t, 1, 'a', "Total fetch", "")
+VSC_F(s_streamed,		uint64_t, 1, 'a', "Total streamed delivery", "")
 VSC_F(s_hdrbytes,		uint64_t, 1, 'a', "Total header bytes", "")
 VSC_F(s_bodybytes,		uint64_t, 1, 'a', "Total body bytes", "")
 
-- 
1.7.4.1




More information about the varnish-dev mailing list