MCPcopy Create free account
hub / github.com/apache/arrow / BenchmarkStreamingWrites

Function BenchmarkStreamingWrites

cpp/src/arrow/io/file_benchmark.cc:195–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195static void BenchmarkStreamingWrites(benchmark::State& state,
196 const std::valarray<int64_t>& sizes,
197 io::OutputStream* stream,
198 BackgroundReader* reader = nullptr) {
199 const std::string datastr(sizes.max(), 'x');
200 const void* data = datastr.data();
201 const int64_t sum_sizes = sizes.sum();
202
203 while (state.KeepRunning()) {
204 for (const int64_t size : sizes) {
205 ABORT_NOT_OK(stream->Write(data, size));
206 }
207 }
208 // For Windows: need to close writer before joining reader thread.
209 ABORT_NOT_OK(stream->Close());
210
211 const int64_t total_bytes = static_cast<int64_t>(state.iterations()) * sum_sizes;
212 state.SetBytesProcessed(total_bytes);
213
214 if (reader != nullptr) {
215 // Wake up and stop
216 reader->Stop();
217 reader->Join();
218 }
219}
220
221// Benchmark writing to /dev/null
222//

Calls 7

maxMethod · 0.45
dataMethod · 0.45
sumMethod · 0.45
WriteMethod · 0.45
CloseMethod · 0.45
StopMethod · 0.45
JoinMethod · 0.45

Tested by

no test coverage detected