Commit fb733897 by Kai Wolf

Remove sleep.h dependency for tests

parent f352c30f
# Enable the tests
# Allow the test files to find headers in src/ since we rely on
# SleepForMilliseconds(int milliseconds) in options_test.cc
include_directories(${PROJECT_SOURCE_DIR}/src)
find_package(Threads REQUIRED)
set(CXX03_FLAGS "${CMAKE_CXX_FLAGS}")
......
#include "benchmark/benchmark_api.h"
#include "sleep.h"
#include <chrono>
#include <thread>
void BM_basic(benchmark::State& state) {
while (state.KeepRunning()) {
......@@ -7,8 +9,14 @@ void BM_basic(benchmark::State& state) {
}
void BM_basic_slow(benchmark::State& state) {
int milliseconds = state.range_x();
std::chrono::duration<double, std::milli> sleep_duration {
static_cast<double>(milliseconds)
};
while (state.KeepRunning()) {
benchmark::SleepForMilliseconds(state.range_x());
std::this_thread::sleep_for(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