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
e4fe5963
Commit
e4fe5963
authored
Sep 07, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PH stats for secondary hash key vector lengths.
parent
38879fa6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
ph.c
src/ph.c
+11
-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 @
e4fe5963
...
...
@@ -458,6 +458,7 @@ PH_Stats(const struct ph * const restrict ph,
stats
->
h2buckets_min
=
UINT64_MAX
;
stats
->
h2strings_min
=
UINT64_MAX
;
stats
->
h2klen_min
=
SIZE_MAX
;
for
(
unsigned
i
=
0
;
i
<=
ph
->
h1
->
mask
;
i
++
)
if
(
vbit_test
(
ph
->
collision
,
i
))
{
struct
hash
*
h2
;
...
...
@@ -476,6 +477,14 @@ PH_Stats(const struct ph * const restrict ph,
((
double
)
sz
-
stats
->
h2buckets_avg
)
/
(
double
)
stats
->
collisions
;
if
(
h2
->
l
<
stats
->
h2klen_min
)
stats
->
h2klen_min
=
h2
->
l
;
if
(
h2
->
l
>
stats
->
h2klen_max
)
stats
->
h2klen_max
=
h2
->
l
;
stats
->
h2klen_avg
+=
((
double
)
h2
->
l
-
stats
->
h2klen_avg
)
/
(
double
)
stats
->
collisions
;
for
(
unsigned
j
=
0
;
j
<
sz
;
j
++
)
{
if
(
h2
->
tbl
[
j
]
==
UINT_MAX
)
continue
;
...
...
@@ -493,6 +502,8 @@ PH_Stats(const struct ph * const restrict ph,
stats
->
h2buckets_min
=
0
;
if
(
stats
->
h2strings_min
==
UINT64_MAX
)
stats
->
h2strings_min
=
0
;
if
(
stats
->
h2klen_min
==
SIZE_MAX
)
stats
->
h2klen_min
=
0
;
}
void
...
...
src/ph.h
View file @
e4fe5963
...
...
@@ -56,6 +56,9 @@ struct ph_stats {
uint64_t
h2strings_min
;
uint64_t
h2strings_max
;
double
h2strings_avg
;
size_t
h2klen_min
;
size_t
h2klen_max
;
double
h2klen_avg
;
};
/*
...
...
src/tests/bench/bench_ph.c
View file @
e4fe5963
...
...
@@ -335,6 +335,9 @@ main(int argc, char *argv[])
printf
(
"%lu h2 min strings
\n
"
,
stats
.
h2strings_min
);
printf
(
"%lu h2 max strings
\n
"
,
stats
.
h2strings_max
);
printf
(
"%.1f h2 mean strings
\n
"
,
stats
.
h2strings_avg
);
printf
(
"%lu h2 min key vector length
\n
"
,
stats
.
h2klen_min
);
printf
(
"%lu h2 max key vector length
\n
"
,
stats
.
h2klen_max
);
printf
(
"%.1f h2 mean key vector length
\n
"
,
stats
.
h2klen_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