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
601b5fe3
Commit
601b5fe3
authored
Jun 05, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more stats.
parent
52dbe645
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
ph.c
src/ph.c
+18
-3
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 @
601b5fe3
...
...
@@ -445,10 +445,11 @@ PH_Stats(const struct ph * const restrict ph,
stats
->
maxlen
=
ph
->
maxlen
;
stats
->
h2buckets_min
=
UINT64_MAX
;
stats
->
h2strings_min
=
UINT64_MAX
;
for
(
unsigned
i
=
0
;
i
<=
ph
->
h1
->
mask
;
i
++
)
if
(
vbit_test
(
ph
->
collision
,
i
))
{
struct
hash
*
h2
;
uint64_t
sz
;
uint64_t
sz
,
nstrings
=
0
;
h2
=
ph
->
tbl
[
i
].
h2
;
CHECK_OBJ_NOTNULL
(
h2
,
HASH_MAGIC
);
...
...
@@ -460,8 +461,22 @@ PH_Stats(const struct ph * const restrict ph,
if
(
sz
>
stats
->
h2buckets_max
)
stats
->
h2buckets_max
=
sz
;
stats
->
h2buckets_avg
+=
(
sz
-
stats
->
h2buckets_avg
)
/
stats
->
collisions
;
((
double
)
sz
-
stats
->
h2buckets_avg
)
/
(
double
)
stats
->
collisions
;
for
(
unsigned
j
=
0
;
j
<
sz
;
j
++
)
{
if
(
h2
->
tbl
[
j
]
==
UINT_MAX
)
continue
;
nstrings
++
;
}
AN
(
nstrings
);
if
(
nstrings
<
stats
->
h2strings_min
)
stats
->
h2strings_min
=
nstrings
;
if
(
nstrings
>
stats
->
h2strings_max
)
stats
->
h2strings_max
=
nstrings
;
stats
->
h2strings_avg
+=
((
double
)
nstrings
-
stats
->
h2strings_avg
)
/
(
double
)
stats
->
collisions
;
}
}
...
...
src/ph.h
View file @
601b5fe3
...
...
@@ -53,6 +53,9 @@ struct ph_stats {
uint64_t
h2buckets_min
;
uint64_t
h2buckets_max
;
double
h2buckets_avg
;
uint64_t
h2strings_min
;
uint64_t
h2strings_max
;
double
h2strings_avg
;
};
/*
...
...
src/tests/bench/bench_ph.c
View file @
601b5fe3
...
...
@@ -332,6 +332,9 @@ main(int argc, char *argv[])
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
);
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
);
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