Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Tobias Langer
/
experiment
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0df44cd0
authored
Nov 14, 2016
by
Tobias Langer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Active waiting instead of sleeping.
parent
669bfff1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
templates/normal/experiment.cpp
+9
-4
No files found.
templates/normal/experiment.cpp
View file @
0df44cd0
...
...
@@ -29,6 +29,13 @@ auto loop_count(int duration) -> long long
return
m
*
(
float
)
duration
+
t
;
}
auto
active_wait
(
int
duration
)
->
void
{
for
(
int
i
=
0
;
i
<
loop_count
(
duration
);
i
++
)
{
donotoptimize
();
}
}
auto
gcd
(
long
long
a
,
long
long
b
)
->
long
long
{
return
b
==
0
?
a
:
gcd
(
b
,
a
%
b
);
...
...
@@ -126,9 +133,7 @@ static void IdleTask(const void* args, mtapi_size_t, void*, mtapi_size_t,
/* idle until task completion. */
auto
idle_time
=
taskset
[
task_id
].
wcet
;
for
(
int
i
=
0
;
i
<
loop_count
(
idle_time
);
i
++
)
{
donotoptimize
();
}
active_wait
(
idle_time
);
/* Store our benchmarking data. */
auto
end_time
=
base_clock
::
now
();
...
...
@@ -214,7 +219,7 @@ static void TaskStarter()
}
}
std
::
this_thread
::
sleep_for
(
min
);
active_wait
(
min
.
count
()
);
cur_time
=
duration_cast
<
cpp_time_base
>
(
base_clock
::
now
()
-
start
);
}
...
...
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