Commit 96446f75 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a dynamic stats structure for lock information



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5212 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 77fdf476
......@@ -56,3 +56,11 @@ struct vsc_vbe {
#include "vsc_fields.h"
#undef VSC_F_VBE
};
#define VSC_TYPE_LCK "LCK"
struct vsc_lck {
#define VSC_F_LCK(n, t, l, f, e) t n;
#include "vsc_fields.h"
#undef VSC_F_LCK
};
......@@ -202,3 +202,20 @@ VSC_F_VBE(happy, uint64_t, 0, 'b', "Happy health probes")
#undef VSC_F_VBE
#undef __VSC_F_VBE
#endif
/**********************************************************************/
#ifndef VSC_F_LCK
#define VSC_F_LCK(a, b, c, d, e)
#define __VSC_F_LCK
#endif
VSC_F_LCK(creat, uint64_t, 0, 'a', "Created locks")
VSC_F_LCK(destroy, uint64_t, 0, 'a', "Destroyed locks")
VSC_F_LCK(locks, uint64_t, 0, 'a', "Lock Operations")
VSC_F_LCK(colls, uint64_t, 0, 'a', "Collisions")
#ifdef __VSC_F_LCK
#undef VSC_F_LCK
#undef __VSC_F_LCK
#endif
......@@ -367,6 +367,34 @@ iter_vbe(const struct vsc *vsc, struct vsm_chunk *sha, vsc_iter_f *func,
return (0);
}
static int
iter_lck(const struct vsc *vsc, struct vsm_chunk *sha, vsc_iter_f *func,
void *priv)
{
struct vsc_lck *st;
struct vsc_point sp;
int i;
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC);
CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC);
st = VSM_PTR(sha);
sp.class = VSC_TYPE_LCK;
sp.ident = sha->ident;
#define VSC_F_LCK(nn, tt, ll, ff, dd) \
sp.name = #nn; \
sp.fmt = #tt; \
sp.flag = ff; \
sp.desc = dd; \
sp.ptr = &st->nn; \
i = iter_call(vsc, func, priv, &sp); \
if (i) \
return(i);
#include "vsc_fields.h"
#undef VSC_F_LCK
return (0);
}
int
VSC_Iter(struct VSM_data *vd, vsc_iter_f *func, void *priv)
{
......@@ -389,6 +417,8 @@ VSC_Iter(struct VSM_data *vd, vsc_iter_f *func, void *priv)
i = iter_sma(vsc, sha, func, priv);
else if (!strcmp(sha->type, VSC_TYPE_VBE))
i = iter_vbe(vsc, sha, func, priv);
else if (!strcmp(sha->type, VSC_TYPE_LCK))
i = iter_lck(vsc, sha, func, priv);
else
i = -1;
if (i != 0)
......
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