Skip to content

Commit 91f75c4

Browse files
committed
fixup: try use real time
1 parent 5bb87f3 commit 91f75c4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

examples/google_benchmark_cmake/sleep_bench.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,53 @@ static void BM_sleep_1ns(benchmark::State& state) {
1010
std::this_thread::sleep_for(std::chrono::nanoseconds(1));
1111
}
1212
}
13-
BENCHMARK(BM_sleep_1ns);
13+
BENCHMARK(BM_sleep_1ns)->UseRealTime();
1414

1515
static void BM_sleep_100ns(benchmark::State& state) {
1616
for (auto _ : state) {
1717
std::this_thread::sleep_for(std::chrono::nanoseconds(100));
1818
}
1919
}
20-
BENCHMARK(BM_sleep_100ns);
20+
BENCHMARK(BM_sleep_100ns)->UseRealTime();
2121

2222
static void BM_sleep_1us(benchmark::State& state) {
2323
for (auto _ : state) {
2424
std::this_thread::sleep_for(std::chrono::microseconds(1));
2525
}
2626
}
27-
BENCHMARK(BM_sleep_1us);
27+
BENCHMARK(BM_sleep_1us)->UseRealTime();
2828

2929
static void BM_sleep_100us(benchmark::State& state) {
3030
for (auto _ : state) {
3131
std::this_thread::sleep_for(std::chrono::microseconds(100));
3232
}
3333
}
34-
BENCHMARK(BM_sleep_100us);
34+
BENCHMARK(BM_sleep_100us)->UseRealTime();
3535

3636
static void BM_sleep_1ms(benchmark::State& state) {
3737
for (auto _ : state) {
3838
std::this_thread::sleep_for(std::chrono::milliseconds(1));
3939
}
4040
}
41-
BENCHMARK(BM_sleep_1ms);
41+
BENCHMARK(BM_sleep_1ms)->UseRealTime();
4242

4343
static void BM_sleep_10ms(benchmark::State& state) {
4444
for (auto _ : state) {
4545
std::this_thread::sleep_for(std::chrono::milliseconds(10));
4646
}
4747
}
48-
BENCHMARK(BM_sleep_10ms);
48+
BENCHMARK(BM_sleep_10ms)->UseRealTime();
4949

5050
static void BM_sleep_50ms(benchmark::State& state) {
5151
for (auto _ : state) {
5252
std::this_thread::sleep_for(std::chrono::milliseconds(50));
5353
}
5454
}
55-
BENCHMARK(BM_sleep_50ms);
55+
BENCHMARK(BM_sleep_50ms)->UseRealTime();
5656

5757
static void BM_sleep_100ms(benchmark::State& state) {
5858
for (auto _ : state) {
5959
std::this_thread::sleep_for(std::chrono::milliseconds(100));
6060
}
6161
}
62-
BENCHMARK(BM_sleep_100ms);
62+
BENCHMARK(BM_sleep_100ms)->UseRealTime();

0 commit comments

Comments
 (0)