Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
syscall-eval
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informatik 4 (Systemsoftware)
manycore
syscall-eval
Commits
0cf52e2f
Commit
0cf52e2f
authored
3 years ago
by
Florian Fischer
Browse files
Options
Downloads
Patches
Plain Diff
make experiment size adjustable
parent
c6ded6c5
No related branches found
No related tags found
1 merge request
!3
Work work work
Pipeline
#66506
passed
3 years ago
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
bench.c
+10
-6
10 additions, 6 deletions
bench.c
common.h
+2
-0
2 additions, 0 deletions
common.h
paio-thrd.c
+4
-0
4 additions, 0 deletions
paio-thrd.c
with
16 additions
and
6 deletions
bench.c
+
10
−
6
View file @
0cf52e2f
...
...
@@ -12,8 +12,8 @@
void
init
(
int
fd
);
void
do_write
(
int
fd
,
const
void
*
buf
,
size_t
count
);
const
size_t
warmup
=
10000
;
const
size_t
iterations
=
1000000
;
size_t
warmup
=
10000
;
size_t
iterations
=
1000000
;
#define BUFSIZE 64
...
...
@@ -44,10 +44,14 @@ int main() {
int
fd
=
create_eventfd
();
init
(
fd
);
const
size_t
exp_warmup
=
warmup
;
const
size_t
exp_iterations
=
iterations
;
for
(
size_t
i
=
0
;
i
<
warmup
;
++
i
)
do_write
(
fd
,
&
write_buf
,
sizeof
(
write_buf
)
);
if
(
exp_iterations
==
0
)
errx
(
EXIT_FAILURE
,
"experiment must do at least one iteration"
);
for
(
int64_t
i
=
1
;
i
<=
iterations
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
exp_warmup
;
++
i
)
do_write
(
fd
,
&
write_buf
,
sizeof
(
write_buf
));
for
(
int64_t
i
=
1
;
i
<=
exp_iterations
;
++
i
)
{
do_write
(
fd
,
&
write_buf
,
sizeof
(
write_buf
));
if
(
__builtin_add_overflow
(
nanos_sum
,
clock_diff_nanos
(),
&
nanos_sum
))
errx
(
EXIT_FAILURE
,
"nanos overflowed at %ld"
,
i
);
...
...
@@ -58,8 +62,8 @@ int main() {
// Since uint64_t <-> double conversion are not well defined
// and we use really small units (cycles and nanoseconds) I am willing
// to accept that we throw away anything after the decimal point.
uint64_t
avg_nanos
=
nanos_sum
/
iterations
;
uint64_t
avg_cycles
=
cycles_sum
/
iterations
;
uint64_t
avg_nanos
=
nanos_sum
/
exp_
iterations
;
uint64_t
avg_cycles
=
cycles_sum
/
exp_
iterations
;
printf
(
"%lu ns, %lu cycles
\n
"
,
avg_nanos
,
avg_cycles
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
common.h
+
2
−
0
View file @
0cf52e2f
#pragma once
#define unlikely(x) __builtin_expect(!!(x), 0)
extern
size_t
warmup
,
iterations
;
This diff is collapsed.
Click to expand it.
paio-thrd.c
+
4
−
0
View file @
0cf52e2f
...
...
@@ -5,6 +5,7 @@
#include
<stdint.h>
#include
<stdlib.h>
#include
"common.h"
#include
"stopwatch.h"
atomic_int
done
;
...
...
@@ -19,6 +20,9 @@ void callback(union sigval sigval) {
}
void
init
(
int
fd
)
{
// decrease the experiment size because this takes much longer than anything else
warmup
=
10
;
iterations
=
100
;
aiocb
.
aio_fildes
=
fd
;
aiocb
.
aio_sigevent
.
sigev_notify
=
SIGEV_THREAD
;
aiocb
.
aio_sigevent
.
sigev_notify_function
=
callback
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment