Cache / main memory latency, depending on the working set size
| 54 | |
| 55 | // Cache / main memory latency, depending on the working set size |
| 56 | static void memory_latency(benchmark::State& state) { |
| 57 | const auto niters = static_cast<int32_t>(state.range(0)); |
| 58 | const std::vector<int32_t> path = RandomPath(niters / 4); |
| 59 | |
| 60 | int32_t total = 0; |
| 61 | int32_t index = 0; |
| 62 | for (auto _ : state) { |
| 63 | total += index; |
| 64 | index = path[index]; |
| 65 | } |
| 66 | benchmark::DoNotOptimize(total); |
| 67 | state.SetItemsProcessed(state.iterations()); |
| 68 | } |
| 69 | |
| 70 | BENCHMARK(memory_latency)->Repetitions(1)->RangeMultiplier(2)->Range(2 << 10, 2 << 24); |
| 71 |
nothing calls this directly
no test coverage detected