| 315 | ->UseRealTime(); |
| 316 | |
| 317 | static void BenchmarkBufferOutputStream( |
| 318 | const std::string& datum, |
| 319 | benchmark::State& state) { // NOLINT non-const reference |
| 320 | const void* raw_data = datum.data(); |
| 321 | int64_t raw_nbytes = static_cast<int64_t>(datum.size()); |
| 322 | // Write approx. 32 MB to each BufferOutputStream |
| 323 | int64_t num_raw_values = (1 << 25) / raw_nbytes; |
| 324 | for (auto _ : state) { |
| 325 | auto stream = *io::BufferOutputStream::Create(1024); |
| 326 | for (int64_t i = 0; i < num_raw_values; ++i) { |
| 327 | ABORT_NOT_OK(stream->Write(raw_data, raw_nbytes)); |
| 328 | } |
| 329 | ABORT_NOT_OK(stream->Finish()); |
| 330 | } |
| 331 | state.SetBytesProcessed(int64_t(state.iterations()) * num_raw_values * raw_nbytes); |
| 332 | } |
| 333 | |
| 334 | static void BufferOutputStreamTinyWrites( |
| 335 | benchmark::State& state) { // NOLINT non-const reference |
no test coverage detected