Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-selector
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-selector
Commits
3df6c1fa
Commit
3df6c1fa
authored
Feb 26, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stats setsz and nodesz.
parent
729b8c44
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
0 deletions
+30
-0
patricia.c
src/patricia.c
+1
-0
patricia.h
src/patricia.h
+1
-0
selector.vsc
src/selector.vsc
+14
-0
stats.vtc
src/tests/stats.vtc
+10
-0
vmod_selector.c
src/vmod_selector.c
+4
-0
No files found.
src/patricia.c
View file @
3df6c1fa
...
@@ -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
);
}
}
src/patricia.h
View file @
3df6c1fa
...
@@ -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
;
...
...
src/selector.vsc
View file @
3df6c1fa
...
@@ -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
...
...
src/tests/stats.vtc
View file @
3df6c1fa
...
@@ -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
...
...
src/vmod_selector.c
View file @
3df6c1fa
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment