File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
examples/google_benchmark_cmake Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,34 @@ static inline void busy_sleep_for(std::chrono::nanoseconds duration) {
1212 }
1313}
1414
15+ static void BM_sleep_1ns (benchmark::State& state) {
16+ for (auto _ : state) {
17+ busy_sleep_for (std::chrono::nanoseconds (1 ));
18+ }
19+ }
20+ BENCHMARK (BM_sleep_1ns);
21+
22+ static void BM_sleep_10ns (benchmark::State& state) {
23+ for (auto _ : state) {
24+ busy_sleep_for (std::chrono::nanoseconds (10 ));
25+ }
26+ }
27+ BENCHMARK (BM_sleep_10ns);
28+
29+ static void BM_sleep_50ns (benchmark::State& state) {
30+ for (auto _ : state) {
31+ busy_sleep_for (std::chrono::nanoseconds (50 ));
32+ }
33+ }
34+ BENCHMARK (BM_sleep_50ns);
35+
36+ static void BM_sleep_100ns (benchmark::State& state) {
37+ for (auto _ : state) {
38+ busy_sleep_for (std::chrono::nanoseconds (100 ));
39+ }
40+ }
41+ BENCHMARK (BM_sleep_100ns);
42+
1543static void BM_sleep_1us (benchmark::State& state) {
1644 for (auto _ : state) {
1745 busy_sleep_for (std::chrono::microseconds (1 ));
You can’t perform that action at this time.
0 commit comments