Commit 1bd62bd0 by Eric Fiselier

Revert "Workaround missing std::this_thread::sleep_for function in tests."

GCC 4.6 doesn't provide std::chrono::steady_clock and GCC 4.7 doesn't provide std::this_thread::sleep_for. I would prefer to support GCC 4.7 but I'm reverting this since the bots are GCC 4.6. This reverts commit c5f45495.
parent c5f45495
......@@ -186,11 +186,9 @@ static void BM_ManualTiming(benchmark::State& state) {
while (state.KeepRunning()) {
auto start = std::chrono::high_resolution_clock::now();
// Simulate some useful workload by sleeping.
// Note: std::this_thread::sleep_for doesn't work with GCC 4.7 on some
// platforms.
const auto sleep_end = std::chrono::steady_clock::now() + sleep_duration;
while (std::chrono::steady_clock::now() < sleep_end) {}
// Simulate some useful workload with a sleep
std::this_thread::sleep_for(std::chrono::duration_cast<
std::chrono::nanoseconds>(sleep_duration));
auto end = std::chrono::high_resolution_clock::now();
auto elapsed =
......
......@@ -11,11 +11,9 @@ void BM_basic(benchmark::State& state) {
void BM_basic_slow(benchmark::State& state) {
std::chrono::milliseconds sleep_duration(state.range_x());
while (state.KeepRunning()) {
// Simulate some useful workload by sleeping.
// Note: std::this_thread::sleep_for doesn't work with GCC 4.7 on some
// platforms.
const auto sleep_end = std::chrono::steady_clock::now() + sleep_duration;
while (std::chrono::steady_clock::now() < sleep_end) {}
std::this_thread::sleep_for(
std::chrono::duration_cast<std::chrono::nanoseconds>(sleep_duration)
);
}
}
......
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