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 c5f454957d.
This commit is contained in:
Eric Fiselier 2016-07-22 15:42:26 -06:00
parent c5f454957d
commit 1bd62bd0be
2 changed files with 6 additions and 10 deletions

View File

@ -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 =

View File

@ -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)
);
}
}