Commit 0df44cd0 by Tobias Langer

Active waiting instead of sleeping.

parent 669bfff1
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment