From 881c4ad49fe205892e79e3b5278ef947f018ea99 Mon Sep 17 00:00:00 2001 From: Tobias Langer Date: Tue, 11 Oct 2016 13:12:42 +0200 Subject: [PATCH] Fixed problem with wrong timestamp. Now timestamps are printed relative to task start. --- templates/normal/experiment.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/normal/experiment.cpp b/templates/normal/experiment.cpp index ef06368..dd1d569 100644 --- a/templates/normal/experiment.cpp +++ b/templates/normal/experiment.cpp @@ -34,8 +34,8 @@ auto calculate_hyperperiod() -> long long } struct timestamps { - base_clock::time_point start; - base_clock::time_point end; + cpp_time_base::duration start; + cpp_time_base::duration end; int core_id = 0; }; @@ -59,12 +59,12 @@ void benchmark_out() std::cout << "executions " << taskset[i].count << std::endl; for(int j = 0; j < benchmark[i].size(); j++) { - auto start = base_clock::to_time_t(benchmark[i][j].start); - auto end = base_clock::to_time_t(benchmark[i][j].end); + auto task_start = benchmark[i][j].start.count(); + auto task_end = benchmark[i][j].end.count(); auto core_id = benchmark[i][j].core_id; std::cout << "instance " << j << " "; - std::cout << "start " << start << " "; - std::cout << "end " << end << " "; + std::cout << "start " << task_start << " "; + std::cout << "end " << end_task << " "; std::cout << "core_id " << core_id << std::endl; } } @@ -112,8 +112,8 @@ static void IdleTask(const void* args, mtapi_size_t, void*, mtapi_size_t, auto end_time = base_clock::now(); int core_id = sched_getcpu(); - benchmark[task_id][task_num - 1].start = start_time; - benchmark[task_id][task_num - 1].end = end_time; + benchmark[task_id][task_num - 1].start = duration_cast(start_time - start); + benchmark[task_id][task_num - 1].end = duration_cast(end_time - start); benchmark[task_id][task_num - 1].core_id = core_id; } -- libgit2 0.26.0