Skip to content

Commit

Permalink
apacheGH-39666: [C++] Ensure CSV and JSON benchmarks present a bytes/…
Browse files Browse the repository at this point in the history
…s or items/s metric
  • Loading branch information
pitrou committed Jan 23, 2024
1 parent 7e9f265 commit d7f290a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/src/arrow/csv/writer_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void BenchmarkWriteCsv(benchmark::State& state, const WriteOptions& options,
const RecordBatch& batch) {
int64_t total_size = 0;

while (state.KeepRunning()) {
for (auto _ : state) {
auto out = io::BufferOutputStream::Create().ValueOrDie();
ABORT_NOT_OK(WriteCSV(batch, options, out.get()));
auto buffer = out->Finish().ValueOrDie();
Expand All @@ -106,6 +106,7 @@ void BenchmarkWriteCsv(benchmark::State& state, const WriteOptions& options,

// byte size of the generated csv dataset
state.SetBytesProcessed(total_size);
state.SetItemsProcessed(state.iterations() * batch.num_columns() * batch.num_rows());
state.counters["null_percent"] = static_cast<double>(state.range(0));
}

Expand Down

0 comments on commit d7f290a

Please sign in to comment.