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
52dbe645
Commit
52dbe645
authored
Jun 04, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more stats.
parent
b4e64240
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
ph.c
src/ph.c
+10
-0
ph.h
src/ph.h
+3
-0
bench_ph.c
src/tests/bench/bench_ph.c
+3
-0
No files found.
src/ph.c
View file @
52dbe645
...
...
@@ -444,14 +444,24 @@ PH_Stats(const struct ph * const restrict ph,
stats
->
minlen
=
ph
->
minlen
;
stats
->
maxlen
=
ph
->
maxlen
;
stats
->
h2buckets_min
=
UINT64_MAX
;
for
(
unsigned
i
=
0
;
i
<=
ph
->
h1
->
mask
;
i
++
)
if
(
vbit_test
(
ph
->
collision
,
i
))
{
struct
hash
*
h2
;
uint64_t
sz
;
h2
=
ph
->
tbl
[
i
].
h2
;
CHECK_OBJ_NOTNULL
(
h2
,
HASH_MAGIC
);
sz
=
h2
->
mask
+
1
;
stats
->
collisions
++
;
if
(
sz
<
stats
->
h2buckets_min
)
stats
->
h2buckets_min
=
sz
;
if
(
sz
>
stats
->
h2buckets_max
)
stats
->
h2buckets_max
=
sz
;
stats
->
h2buckets_avg
+=
(
sz
-
stats
->
h2buckets_avg
)
/
stats
->
collisions
;
}
}
...
...
src/ph.h
View file @
52dbe645
...
...
@@ -50,6 +50,9 @@ struct ph_stats {
uint64_t
klen
;
uint64_t
minlen
;
uint64_t
maxlen
;
uint64_t
h2buckets_min
;
uint64_t
h2buckets_max
;
double
h2buckets_avg
;
};
/*
...
...
src/tests/bench/bench_ph.c
View file @
52dbe645
...
...
@@ -329,6 +329,9 @@ main(int argc, char *argv[])
printf
(
"%lu key vector length
\n
"
,
stats
.
klen
);
printf
(
"%lu min string length
\n
"
,
stats
.
minlen
);
printf
(
"%lu max string length
\n
"
,
stats
.
maxlen
);
printf
(
"%lu h2 min buckets
\n
"
,
stats
.
h2buckets_min
);
printf
(
"%lu h2 max buckets
\n
"
,
stats
.
h2buckets_max
);
printf
(
"%.1f h2 mean buckets
\n
"
,
stats
.
h2buckets_avg
);
if
(
do_iters
==
0
)
exit
(
EXIT_SUCCESS
);
...
...
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