Commit 3df6c1fa authored by Geoff Simmons's avatar Geoff Simmons

Add stats setsz and nodesz.

parent 729b8c44
...@@ -415,6 +415,7 @@ PT_Stats(const struct pt_y * const restrict root, ...@@ -415,6 +415,7 @@ PT_Stats(const struct pt_y * const restrict root,
stats->dmin = UINT64_MAX; stats->dmin = UINT64_MAX;
stats->dmax = 0; stats->dmax = 0;
stats->davg = 0.; stats->davg = 0.;
stats->nodesz = sizeof(*root);
pt_stats(root, strings, stats, 0); pt_stats(root, strings, stats, 0);
} }
...@@ -51,6 +51,7 @@ struct pt_stats { ...@@ -51,6 +51,7 @@ struct pt_stats {
uint64_t nodes; uint64_t nodes;
uint64_t leaves; uint64_t leaves;
uint64_t terms; uint64_t terms;
uint64_t nodesz;
uint64_t dmin; uint64_t dmin;
uint64_t dmax; uint64_t dmax;
double davg; double davg;
......
...@@ -12,12 +12,26 @@ ...@@ -12,12 +12,26 @@
Number of elements (strings) in the set. Number of elements (strings) in the set.
.. varnish_vsc:: setsz
:type: gauge
:oneliner: Set size
Total size of the strings in the set -- the sum of the lengths
of all of the strings, including their terminating null bytes.
.. varnish_vsc:: nodes .. varnish_vsc:: nodes
:type: gauge :type: gauge
:oneliner: Nodes :oneliner: Nodes
Total number of nodes in the internal data structure. Total number of nodes in the internal data structure.
.. varnish_vsc:: nodesz
:type: gauge
:oneliner: Node size
Size of a node in bytes. Total size of the internal data
structure is nodes * nodesz.
.. varnish_vsc:: leaves .. varnish_vsc:: leaves
:type: gauge :type: gauge
:oneliner: Leaf nodes :oneliner: Leaf nodes
......
...@@ -19,7 +19,9 @@ varnish v1 -vcl { ...@@ -19,7 +19,9 @@ varnish v1 -vcl {
varnish v1 -vsc SELECTOR.* varnish v1 -vsc SELECTOR.*
varnish v1 -expect SELECTOR.vcl1.s.elements == 4 varnish v1 -expect SELECTOR.vcl1.s.elements == 4
varnish v1 -expect SELECTOR.vcl1.s.setsz == 17
varnish v1 -expect SELECTOR.vcl1.s.nodes > 0 varnish v1 -expect SELECTOR.vcl1.s.nodes > 0
varnish v1 -expect SELECTOR.vcl1.s.nodesz > 0
varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4 varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4
varnish v1 -expect SELECTOR.vcl1.s.dmin > 0 varnish v1 -expect SELECTOR.vcl1.s.dmin > 0
varnish v1 -expect SELECTOR.vcl1.s.dmax > 0 varnish v1 -expect SELECTOR.vcl1.s.dmax > 0
...@@ -55,14 +57,18 @@ varnish v1 -vcl { ...@@ -55,14 +57,18 @@ varnish v1 -vcl {
varnish v1 -vsc SELECTOR.* varnish v1 -vsc SELECTOR.*
varnish v1 -expect SELECTOR.vcl2.p.elements == 4 varnish v1 -expect SELECTOR.vcl2.p.elements == 4
varnish v1 -expect SELECTOR.vcl2.p.setsz == 35
varnish v1 -expect SELECTOR.vcl2.p.nodes > 0 varnish v1 -expect SELECTOR.vcl2.p.nodes > 0
varnish v1 -expect SELECTOR.vcl2.p.nodesz > 0
varnish v1 -expect SELECTOR.vcl2.p.leaves <= 4 varnish v1 -expect SELECTOR.vcl2.p.leaves <= 4
varnish v1 -expect SELECTOR.vcl2.p.dmin > 0 varnish v1 -expect SELECTOR.vcl2.p.dmin > 0
varnish v1 -expect SELECTOR.vcl2.p.dmax > 0 varnish v1 -expect SELECTOR.vcl2.p.dmax > 0
varnish v1 -expect SELECTOR.vcl2.p.davg > 0 varnish v1 -expect SELECTOR.vcl2.p.davg > 0
varnish v1 -expect SELECTOR.vcl2.e.elements == 0 varnish v1 -expect SELECTOR.vcl2.e.elements == 0
varnish v1 -expect SELECTOR.vcl2.e.setsz == 0
varnish v1 -expect SELECTOR.vcl2.e.nodes == 0 varnish v1 -expect SELECTOR.vcl2.e.nodes == 0
varnish v1 -expect SELECTOR.vcl2.e.nodesz == 0
varnish v1 -expect SELECTOR.vcl2.e.leaves == 0 varnish v1 -expect SELECTOR.vcl2.e.leaves == 0
varnish v1 -expect SELECTOR.vcl2.e.dmin == 0 varnish v1 -expect SELECTOR.vcl2.e.dmin == 0
varnish v1 -expect SELECTOR.vcl2.e.dmax == 0 varnish v1 -expect SELECTOR.vcl2.e.dmax == 0
...@@ -76,7 +82,9 @@ varnish v1 -vsc SELECTOR.* ...@@ -76,7 +82,9 @@ varnish v1 -vsc SELECTOR.*
varnish v1 -cliok "vcl.state vcl1 warm" varnish v1 -cliok "vcl.state vcl1 warm"
varnish v1 -vsc SELECTOR.* varnish v1 -vsc SELECTOR.*
varnish v1 -expect SELECTOR.vcl1.s.elements == 4 varnish v1 -expect SELECTOR.vcl1.s.elements == 4
varnish v1 -expect SELECTOR.vcl1.s.setsz == 17
varnish v1 -expect SELECTOR.vcl1.s.nodes > 0 varnish v1 -expect SELECTOR.vcl1.s.nodes > 0
varnish v1 -expect SELECTOR.vcl1.s.nodesz > 0
varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4 varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4
varnish v1 -expect SELECTOR.vcl1.s.dmin > 0 varnish v1 -expect SELECTOR.vcl1.s.dmin > 0
varnish v1 -expect SELECTOR.vcl1.s.dmax > 0 varnish v1 -expect SELECTOR.vcl1.s.dmax > 0
...@@ -194,7 +202,9 @@ varnish v1 -vcl { ...@@ -194,7 +202,9 @@ varnish v1 -vcl {
} }
varnish v1 -expect SELECTOR.vcl3.words.elements == 100 varnish v1 -expect SELECTOR.vcl3.words.elements == 100
varnish v1 -expect SELECTOR.vcl3.words.setsz == 927
varnish v1 -expect SELECTOR.vcl3.words.nodes > 0 varnish v1 -expect SELECTOR.vcl3.words.nodes > 0
varnish v1 -expect SELECTOR.vcl3.words.nodesz > 0
varnish v1 -expect SELECTOR.vcl3.words.leaves <= 100 varnish v1 -expect SELECTOR.vcl3.words.leaves <= 100
varnish v1 -expect SELECTOR.vcl3.words.dmin > 0 varnish v1 -expect SELECTOR.vcl3.words.dmin > 0
varnish v1 -expect SELECTOR.vcl3.words.dmax > 0 varnish v1 -expect SELECTOR.vcl3.words.dmax > 0
......
...@@ -817,16 +817,20 @@ vmod_set_create_stats(VRT_CTX, struct vmod_selector_set *set, ...@@ -817,16 +817,20 @@ vmod_set_create_stats(VRT_CTX, struct vmod_selector_set *set,
assert(stats.dmin <= stats.dmax); assert(stats.dmin <= stats.dmax);
assert(stats.dmin <= stats.davg); assert(stats.dmin <= stats.davg);
assert(stats.davg <= stats.dmax); assert(stats.davg <= stats.dmax);
assert(stats.nodesz > 0);
} }
vsc = VSC_selector_New(NULL, &vsc_seg, "%s.%s", VCL_Name(ctx->vcl), vsc = VSC_selector_New(NULL, &vsc_seg, "%s.%s", VCL_Name(ctx->vcl),
set->vcl_name); set->vcl_name);
vsc->elements = set->nmembers; vsc->elements = set->nmembers;
vsc->nodes = stats.nodes; vsc->nodes = stats.nodes;
vsc->nodesz = stats.nodesz;
vsc->leaves = stats.leaves; vsc->leaves = stats.leaves;
vsc->dmin = stats.dmin; vsc->dmin = stats.dmin;
vsc->dmax = stats.dmax; vsc->dmax = stats.dmax;
vsc->davg = (uint64_t)(stats.davg + 0.5); vsc->davg = (uint64_t)(stats.davg + 0.5);
for (unsigned i = 0; i < set->nmembers; i++)
vsc->setsz += strlen(set->members[i]) + 1;
ALLOC_OBJ(vsc_entry, VMOD_SELECTOR_VSC_MAGIC); ALLOC_OBJ(vsc_entry, VMOD_SELECTOR_VSC_MAGIC);
AN(vsc_entry); AN(vsc_entry);
......
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