| 239 | |
| 240 | template <typename SetBitRunReaderType> |
| 241 | static void BenchmarkSetBitRunReader(benchmark::State& state, int64_t set_percentage) { |
| 242 | constexpr int64_t kNumBits = 4096; |
| 243 | auto buffer = CreateRandomBitsBuffer(kNumBits, set_percentage); |
| 244 | |
| 245 | for (auto _ : state) { |
| 246 | { |
| 247 | SetBitRunReaderType reader(buffer->data(), 0, kNumBits); |
| 248 | int64_t set_total = 0; |
| 249 | internal::SetBitRun br; |
| 250 | do { |
| 251 | br = reader.NextRun(); |
| 252 | set_total += br.length; |
| 253 | } while (br.length != 0); |
| 254 | benchmark::DoNotOptimize(set_total); |
| 255 | } |
| 256 | } |
| 257 | state.SetBytesProcessed(state.iterations() * (kNumBits / 8)); |
| 258 | } |
| 259 | |
| 260 | template <typename VisitBitsFunctorType> |
| 261 | static void BenchmarkVisitBits(benchmark::State& state, int64_t nbytes) { |
nothing calls this directly
no test coverage detected