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) { ...@@ -186,11 +186,9 @@ static void BM_ManualTiming(benchmark::State& state) {
while (state.KeepRunning()) { while (state.KeepRunning()) {
auto start = std::chrono::high_resolution_clock::now(); auto start = std::chrono::high_resolution_clock::now();
// Simulate some useful workload by sleeping. // Simulate some useful workload with a sleep
// Note: std::this_thread::sleep_for doesn't work with GCC 4.7 on some std::this_thread::sleep_for(std::chrono::duration_cast<
// platforms. std::chrono::nanoseconds>(sleep_duration));
const auto sleep_end = std::chrono::steady_clock::now() + sleep_duration;
while (std::chrono::steady_clock::now() < sleep_end) {}
auto end = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now();
auto elapsed = auto elapsed =
......
...@@ -11,11 +11,9 @@ void BM_basic(benchmark::State& state) { ...@@ -11,11 +11,9 @@ void BM_basic(benchmark::State& state) {
void BM_basic_slow(benchmark::State& state) { void BM_basic_slow(benchmark::State& state) {
std::chrono::milliseconds sleep_duration(state.range_x()); std::chrono::milliseconds sleep_duration(state.range_x());
while (state.KeepRunning()) { while (state.KeepRunning()) {
// Simulate some useful workload by sleeping. std::this_thread::sleep_for(
// Note: std::this_thread::sleep_for doesn't work with GCC 4.7 on some std::chrono::duration_cast<std::chrono::nanoseconds>(sleep_duration)
// platforms. );
const auto sleep_end = std::chrono::steady_clock::now() + sleep_duration;
while (std::chrono::steady_clock::now() < sleep_end) {}
} }
} }
......
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