Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
4ec789af
Commit
4ec789af
authored
Nov 04, 2016
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a trivial benchmark to the vtim test
parent
fc71348b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
vtim.c
lib/libvarnish/vtim.c
+25
-0
No files found.
lib/libvarnish/vtim.c
View file @
4ec789af
...
@@ -466,6 +466,29 @@ tst_delta()
...
@@ -466,6 +466,29 @@ tst_delta()
}
}
}
}
static
void
bench
()
{
double
s
,
e
,
t
;
int
i
;
t
=
0
;
s
=
VTIM_real
();
for
(
i
=
0
;
i
<
100000
;
i
++
)
t
+=
VTIM_real
();
e
=
VTIM_real
();
printf
(
"real: %fs / %d = %fns - tst val %f
\n
"
,
e
-
s
,
i
,
1e9
*
(
e
-
s
)
/
i
,
t
);
t
=
0
;
s
=
VTIM_real
();
for
(
i
=
0
;
i
<
100000
;
i
++
)
t
+=
VTIM_mono
();
e
=
VTIM_real
();
printf
(
"mono: %fs / %d = %fns - tst val %f
\n
"
,
e
-
s
,
i
,
1e9
*
(
e
-
s
)
/
i
,
t
);
}
int
int
main
(
int
argc
,
char
**
argv
)
main
(
int
argc
,
char
**
argv
)
{
{
...
@@ -478,6 +501,8 @@ main(int argc, char **argv)
...
@@ -478,6 +501,8 @@ main(int argc, char **argv)
AZ
(
setenv
(
"TZ"
,
"UTC"
,
1
));
AZ
(
setenv
(
"TZ"
,
"UTC"
,
1
));
assert
(
sizeof
t
>=
8
);
assert
(
sizeof
t
>=
8
);
bench
();
/* Brute force test against libc version */
/* Brute force test against libc version */
for
(
t
=
-
2209852800
;
t
<
20000000000
;
t
+=
3599
)
{
for
(
t
=
-
2209852800
;
t
<
20000000000
;
t
+=
3599
)
{
gmtime_r
(
&
t
,
&
tm
);
gmtime_r
(
&
t
,
&
tm
);
...
...
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