Commit 7743ea0f authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Merge branch 'timer_upgrade' into 'master'

Adding wall_clock and sum_wall_clock to radix::Timer.

See merge request !21
parents c73f0616 21574249
Pipeline #11514 failed with stage
in 3 minutes and 29 seconds
......@@ -184,6 +184,22 @@ class Timer
return mDuration.count();
}
size_t intervals() const { return mIntervals; }
double wall_clock()
{
radix_require(!mRunning);
// 1e9 nanoseconds in a second
using seconds = std::chrono::duration<double, std::ratio<1000, 1>>;
return seconds(mEnd - mStart).count();
}
double sum_wall_clock()
{
// 1e9 nanoseconds in a second
using seconds = std::chrono::duration<double, std::ratio<1000, 1>>;
return seconds(mDuration).count();
}
}; // class Timer
} // namespace radix
......
......@@ -44,4 +44,6 @@ TEST(radixbug, Timer)
std::chrono::seconds second((42300 * 3)); // 1.5 days
using days = std::chrono::duration<float, std::ratio<84600, 1>>;
std::cout << "Days: " << days(second).count() << std::endl;
std::cout << "Wall clock (s): " << timer1.wall_clock() << std::endl;
std::cout << "Sum wall clock (s): " << timer1.sum_wall_clock() << std::endl;
}
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 to comment