mirror of
https://github.com/google/benchmark.git
synced 2025-03-23 07:30:07 +08:00
Merge pull request #209 from BillyONeal/fix-appveyor
Fix appveyor's older MSVC++ builds by working around 2015 Update 2 bugfix
This commit is contained in:
commit
539da11250
@ -186,7 +186,8 @@ 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 with a sleep
|
// Simulate some useful workload with a sleep
|
||||||
std::this_thread::sleep_for(sleep_duration);
|
std::this_thread::sleep_for(std::chrono::duration_cast<
|
||||||
|
std::chrono::nanoseconds>(sleep_duration));
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
auto elapsed =
|
auto elapsed =
|
||||||
|
@ -9,14 +9,11 @@ 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());
|
||||||
int milliseconds = state.range_x();
|
|
||||||
std::chrono::duration<double, std::milli> sleep_duration {
|
|
||||||
static_cast<double>(milliseconds)
|
|
||||||
};
|
|
||||||
|
|
||||||
while (state.KeepRunning()) {
|
while (state.KeepRunning()) {
|
||||||
std::this_thread::sleep_for(sleep_duration);
|
std::this_thread::sleep_for(
|
||||||
|
std::chrono::duration_cast<std::chrono::nanoseconds>(sleep_duration)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user