Commit afec9950 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Originally we shaved 64 bytes from the session to the worker thread

by keeping the current requests accounting stats in the worker thread.

For reasons which will be explained in the next commit, this is no
longer a good idea, and this commit moves these counters from
the worker thread to the session at a slight but all in all
trivial cost in memory footprint.

Remove the call to SES_Charge() when we hit a busy object, it is
not necessary to clean the worker thread counters here now.

Move these counters from the worker thread to the see


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3512 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 45edf406
......@@ -199,7 +199,6 @@ struct worker {
struct VCL_conf *vcl;
struct srcaddr *srcaddr;
struct acct acct;
unsigned char *wlb, *wlp, *wle;
unsigned wlr;
......@@ -370,6 +369,7 @@ struct sess {
struct workreq workreq;
struct acct acct;
struct acct acct_req;
/* pointers to hash string components */
unsigned nhashptr;
......
......@@ -427,7 +427,7 @@ cnt_fetch(struct sess *sp)
EXP_Insert(sp->obj);
HSH_Unbusy(sp);
}
sp->wrk->acct.fetch++;
sp->acct_req.fetch++;
sp->step = STP_DELIVER;
return (0);
}
......@@ -457,7 +457,7 @@ cnt_first(struct sess *sp)
/* Receive a HTTP protocol request */
HTC_Init(sp->htc, sp->ws, sp->fd);
sp->wrk->lastused = sp->t_open;
sp->wrk->acct.sess++;
sp->acct_req.sess++;
SES_RefSrcAddr(sp);
do
i = HTC_Rx(sp->htc);
......@@ -591,7 +591,6 @@ cnt_lookup(struct sess *sp)
if (params->diag_bitmap & 0x20)
WSP(sp, SLT_Debug,
"on waiting list <%s>", sp->objhead->hash);
SES_Charge(sp);
return (1);
}
......@@ -721,7 +720,7 @@ cnt_pass(struct sess *sp)
return (0);
}
assert(sp->handling == VCL_RET_PASS);
sp->wrk->acct.pass++;
sp->acct_req.pass++;
HSH_Prealloc(sp);
sp->obj = sp->wrk->nobj;
sp->wrk->nobj = NULL;
......@@ -763,7 +762,7 @@ cnt_pipe(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
sp->wrk->acct.pipe++;
sp->acct_req.pipe++;
http_FilterHeader(sp, HTTPH_R_PIPE);
VCL_pipe_method(sp);
......@@ -871,7 +870,7 @@ cnt_start(struct sess *sp)
VSL_stats->client_req++; /* XXX not locked */
sp->t_req = TIM_real();
sp->wrk->lastused = sp->t_req;
sp->wrk->acct.req++;
sp->acct_req.req++;
/* Assign XID and log */
sp->xid = ++xids; /* XXX not locked */
......
......@@ -84,10 +84,10 @@ PipeSession(struct sess *sp)
TCP_blocking(vc->fd);
WRW_Reserve(w, &vc->fd);
w->acct.hdrbytes += http_Write(w, bereq->http, 0);
sp->acct_req.hdrbytes += http_Write(w, bereq->http, 0);
if (sp->htc->pipeline.b != NULL)
w->acct.bodybytes +=
sp->acct_req.bodybytes +=
WRW_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline));
if (WRW_FlushRelease(w)) {
......
......@@ -140,7 +140,7 @@ RES_WriteObj(struct sess *sp)
WRW_Reserve(sp->wrk, &sp->fd);
if (sp->esis == 0)
sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->http, 1);
if (sp->wantbody && !VTAILQ_EMPTY(&sp->obj->esibits)) {
if (WRW_FlushRelease(sp->wrk)) {
......@@ -161,7 +161,7 @@ RES_WriteObj(struct sess *sp)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
u += st->len;
sp->wrk->acct.bodybytes += st->len;
sp->acct_req.bodybytes += st->len;
#ifdef SENDFILE_WORKS
/*
* XXX: the overhead of setting up sendfile is not
......
......@@ -222,7 +222,7 @@ ses_sum_acct(struct acct *sum, const struct acct *inc)
void
SES_Charge(struct sess *sp)
{
struct acct *a = &sp->wrk->acct;
struct acct *a = &sp->acct_req;
struct acct b;
ses_sum_acct(&sp->acct, a);
......
......@@ -808,7 +808,7 @@ ESI_Deliver(struct sess *sp)
if (Tlen(eb->verbatim)) {
if (sp->http->protover >= 1.1)
(void)WRW_Write(sp->wrk, eb->chunk_length, -1);
sp->wrk->acct.bodybytes += WRW_Write(sp->wrk,
sp->acct_req.bodybytes += WRW_Write(sp->wrk,
eb->verbatim.b, Tlen(eb->verbatim));
if (sp->http->protover >= 1.1)
(void)WRW_Write(sp->wrk, "\r\n", -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment