| 315 | |
| 316 | template <typename GenerateBitsFunctorType> |
| 317 | static void BenchmarkGenerateBits(benchmark::State& state, int64_t nbytes) { |
| 318 | std::shared_ptr<Buffer> buffer = CreateRandomBuffer(nbytes); |
| 319 | |
| 320 | const int64_t num_bits = nbytes * 8; |
| 321 | uint8_t* bitmap = buffer->mutable_data(); |
| 322 | |
| 323 | while (state.KeepRunning()) { |
| 324 | int64_t pattern_index = 0; |
| 325 | const auto generate = [&]() -> bool { |
| 326 | bool b = pattern[pattern_index++]; |
| 327 | if (pattern_index == sizeof(pattern) / sizeof(bool)) { |
| 328 | pattern_index = 0; |
| 329 | } |
| 330 | return b; |
| 331 | }; |
| 332 | GenerateBitsFunctorType()(bitmap, 0, num_bits, generate); |
| 333 | benchmark::ClobberMemory(); |
| 334 | } |
| 335 | state.SetBytesProcessed(state.iterations() * nbytes); |
| 336 | } |
| 337 | |
| 338 | static void BitmapReader(benchmark::State& state) { |
| 339 | BenchmarkBitmapReader<internal::BitmapReader>(state, state.range(0)); |
nothing calls this directly
no test coverage detected