Commit 6063e24b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Account for unresurrected persistent objects in their own stats counter

to fix the discrepancy in the object/objcore count they would otherwise
represent.

XXX: Not quite sure if they should also be counted as a subset of
n_object to give people an easy way to access "total objects available
in cache".  Will decide this later.




git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4226 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent fb04a7ba
......@@ -504,7 +504,7 @@ cnt_fetch(struct sess *sp)
/*
* At this point we are either committed to flesh out the busy
* object we have in the hash or we have let go of it if we ever
* object we have in the hash or we have let go of it, if we ever
* had one.
*/
......
......@@ -306,6 +306,7 @@ exp_timer(struct sess *sp, void *priv)
sp->objhead = oc->objhead;
sp->objcore = oc;
HSH_DerefObjCore(sp);
sp->wrk->stats.n_vampireobject--;
}
}
NEEDLESS_RETURN(NULL);
......
......@@ -183,6 +183,7 @@ HSH_Cleanup(struct worker *w)
if (w->nobjcore != NULL) {
FREE_OBJ(w->nobjcore);
w->stats.n_objectcore--;
w->nobjcore = NULL;
}
if (w->nobjhead != NULL) {
......@@ -419,7 +420,7 @@ HSH_Insert(const struct sess *sp)
/* NB: do not deref objhead the new object inherits our reference */
oc->objhead = oh;
Lck_Unlock(&oh->mtx);
sp->wrk->stats.n_object++;
sp->wrk->stats.n_vampireobject++;
return (oc);
}
......@@ -661,7 +662,6 @@ HSH_DerefObjCore(struct sess *sp)
Lck_Lock(&oh->mtx);
VTAILQ_REMOVE(&oh->objcs, oc, list);
sp->wrk->stats.n_object--;
Lck_Unlock(&oh->mtx);
assert(oh->refcnt > 0);
FREE_OBJ(oc);
......
......@@ -635,6 +635,8 @@ SMP_Fixup(struct sess *sp, struct objhead *oh, struct objcore *oc)
oc->obj->ban = oc->ban;
sg->nfixed++;
sp->wrk->stats.n_object++;
sp->wrk->stats.n_vampireobject--;
}
/*--------------------------------------------------------------------
......
......@@ -40,7 +40,8 @@ varnish v1 -stop
varnish v1 -start
varnish v1 -cliok "debug.xid 2000"
varnish v1 -expect n_object == 2
varnish v1 -expect n_vampireobject == 2
varnish v1 -expect n_object == 0
client c1 {
txreq -url "/foo"
......@@ -50,7 +51,8 @@ client c1 {
expect resp.http.foo == "foo"
} -run
varnish v1 -expect n_object == 2
varnish v1 -expect n_vampireobject == 1
varnish v1 -expect n_object == 1
client c1 {
txreq -url "/bar"
......@@ -61,3 +63,4 @@ client c1 {
} -run
varnish v1 -expect n_object == 2
varnish v1 -expect n_vampireobject == 0
......@@ -52,6 +52,7 @@ MAC_STAT(backend_unused, uint64_t, 0, 'a', "Backend conn. unused")
MAC_STAT(n_sess_mem, uint64_t, 0, 'i', "N struct sess_mem")
MAC_STAT(n_sess, uint64_t, 0, 'i', "N struct sess")
MAC_STAT(n_object, uint64_t, 1, 'i', "N struct object")
MAC_STAT(n_vampireobject, uint64_t, 1, 'i', "N unresurrected objects")
MAC_STAT(n_objectcore, uint64_t, 1, 'i', "N struct objectcore")
MAC_STAT(n_objecthead, uint64_t, 1, 'i', "N struct objecthead")
MAC_STAT(n_smf, uint64_t, 0, 'i', "N struct smf")
......
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