| 219 | |
| 220 | template <typename BitRunReaderType> |
| 221 | static void BenchmarkBitRunReader(benchmark::State& state, int64_t set_percentage) { |
| 222 | constexpr int64_t kNumBits = 4096; |
| 223 | auto buffer = CreateRandomBitsBuffer(kNumBits, set_percentage); |
| 224 | |
| 225 | for (auto _ : state) { |
| 226 | { |
| 227 | BitRunReaderType reader(buffer->data(), 0, kNumBits); |
| 228 | int64_t set_total = 0; |
| 229 | internal::BitRun br; |
| 230 | do { |
| 231 | br = reader.NextRun(); |
| 232 | set_total += br.set ? br.length : 0; |
| 233 | } while (br.length != 0); |
| 234 | benchmark::DoNotOptimize(set_total); |
| 235 | } |
| 236 | } |
| 237 | state.SetBytesProcessed(state.iterations() * (kNumBits / 8)); |
| 238 | } |
| 239 | |
| 240 | template <typename SetBitRunReaderType> |
| 241 | static void BenchmarkSetBitRunReader(benchmark::State& state, int64_t set_percentage) { |
nothing calls this directly
no test coverage detected