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,
stats->dmin = UINT64_MAX;
stats->dmax = 0;
stats->davg = 0.;
stats->nodesz = sizeof(*root);
pt_stats(root, strings, stats, 0);
}
......@@ -51,6 +51,7 @@ struct pt_stats {
uint64_t nodes;
uint64_t leaves;
uint64_t terms;
uint64_t nodesz;
uint64_t dmin;
uint64_t dmax;
double davg;
......
......@@ -12,12 +12,26 @@
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
:type: gauge
:oneliner: Nodes
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
:type: gauge
:oneliner: Leaf nodes
......
......@@ -19,7 +19,9 @@ varnish v1 -vcl {
varnish v1 -vsc SELECTOR.*
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.nodesz > 0
varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4
varnish v1 -expect SELECTOR.vcl1.s.dmin > 0
varnish v1 -expect SELECTOR.vcl1.s.dmax > 0
......@@ -55,14 +57,18 @@ varnish v1 -vcl {
varnish v1 -vsc SELECTOR.*
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.nodesz > 0
varnish v1 -expect SELECTOR.vcl2.p.leaves <= 4
varnish v1 -expect SELECTOR.vcl2.p.dmin > 0
varnish v1 -expect SELECTOR.vcl2.p.dmax > 0
varnish v1 -expect SELECTOR.vcl2.p.davg > 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.nodesz == 0
varnish v1 -expect SELECTOR.vcl2.e.leaves == 0
varnish v1 -expect SELECTOR.vcl2.e.dmin == 0
varnish v1 -expect SELECTOR.vcl2.e.dmax == 0
......@@ -76,7 +82,9 @@ varnish v1 -vsc SELECTOR.*
varnish v1 -cliok "vcl.state vcl1 warm"
varnish v1 -vsc SELECTOR.*
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.nodesz > 0
varnish v1 -expect SELECTOR.vcl1.s.leaves <= 4
varnish v1 -expect SELECTOR.vcl1.s.dmin > 0
varnish v1 -expect SELECTOR.vcl1.s.dmax > 0
......@@ -194,7 +202,9 @@ varnish v1 -vcl {
}
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.nodesz > 0
varnish v1 -expect SELECTOR.vcl3.words.leaves <= 100
varnish v1 -expect SELECTOR.vcl3.words.dmin > 0
varnish v1 -expect SELECTOR.vcl3.words.dmax > 0
......
......@@ -817,16 +817,20 @@ vmod_set_create_stats(VRT_CTX, struct vmod_selector_set *set,
assert(stats.dmin <= stats.dmax);
assert(stats.dmin <= stats.davg);
assert(stats.davg <= stats.dmax);
assert(stats.nodesz > 0);
}
vsc = VSC_selector_New(NULL, &vsc_seg, "%s.%s", VCL_Name(ctx->vcl),
set->vcl_name);
vsc->elements = set->nmembers;
vsc->nodes = stats.nodes;
vsc->nodesz = stats.nodesz;
vsc->leaves = stats.leaves;
vsc->dmin = stats.dmin;
vsc->dmax = stats.dmax;
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);
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