mirror of
https://github.com/google/benchmark.git
synced 2024-12-27 13:00:36 +08:00
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:
parent
c5f454957d
commit
1bd62bd0be
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user