Skip to content

Commit d7f290a

Browse files
committed
apacheGH-39666: [C++] Ensure CSV and JSON benchmarks present a bytes/s or items/s metric
1 parent 7e9f265 commit d7f290a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/src/arrow/csv/writer_benchmark.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void BenchmarkWriteCsv(benchmark::State& state, const WriteOptions& options,
9797
const RecordBatch& batch) {
9898
int64_t total_size = 0;
9999

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

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

0 commit comments

Comments
 (0)