Skip to content

Commit d050bf4

Browse files
xhochywesm
authored andcommitted
PARQUET-597: Add data rates to benchmark output
Author: Uwe L. Korn <uwelk@xhochy.com> Closes apache#94 from xhochy/parquet-597 and squashes the following commits: 6442eb7 [Uwe L. Korn] PARQUET-597: Add data rates to benchmark output Change-Id: Ifce2d31441e7694e4b68ec0c4f41be895f802e46
1 parent bb67f88 commit d050bf4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

cpp/src/parquet/column/column-io-benchmark.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ std::shared_ptr<ColumnDescriptor> Int64Schema(Repetition::type repetition) {
4444
node, repetition != Repetition::REQUIRED, repetition == Repetition::REPEATED);
4545
}
4646

47+
void SetBytesProcessed(::benchmark::State& state, Repetition::type repetition) {
48+
int64_t bytes_processed = state.iterations() * state.range_x() * sizeof(int64_t);
49+
if (repetition != Repetition::REQUIRED) {
50+
bytes_processed += state.iterations() * state.range_x() * sizeof(int16_t);
51+
}
52+
if (repetition == Repetition::REPEATED) {
53+
bytes_processed += state.iterations() * state.range_x() * sizeof(int16_t);
54+
}
55+
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(int16_t));
56+
}
57+
4758
template <Repetition::type repetition>
4859
static void BM_WriteInt64Column(::benchmark::State& state) {
4960
format::ColumnChunk metadata;
@@ -60,6 +71,7 @@ static void BM_WriteInt64Column(::benchmark::State& state) {
6071
values.size(), definition_levels.data(), repetition_levels.data(), values.data());
6172
writer->Close();
6273
}
74+
SetBytesProcessed(state, repetition);
6375
}
6476

6577
BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REQUIRED)->Range(1024, 65536);
@@ -103,6 +115,7 @@ static void BM_ReadInt64Column(::benchmark::State& state) {
103115
repetition_levels_out.data(), values_out.data(), &values_read);
104116
}
105117
}
118+
SetBytesProcessed(state, repetition);
106119
}
107120

108121
BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REQUIRED)

cpp/src/parquet/encodings/encoding-benchmark.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static void BM_PlainEncodingBoolean(::benchmark::State& state) {
3131
InMemoryOutputStream dst;
3232
encoder.Encode(values, values.size(), &dst);
3333
}
34+
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(bool));
3435
}
3536

3637
BENCHMARK(BM_PlainEncodingBoolean)->Range(1024, 65536);
@@ -49,6 +50,7 @@ static void BM_PlainDecodingBoolean(::benchmark::State& state) {
4950
decoder.Decode(output, values.size());
5051
}
5152

53+
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(bool));
5254
delete[] output;
5355
}
5456

@@ -62,6 +64,7 @@ static void BM_PlainEncodingInt64(::benchmark::State& state) {
6264
InMemoryOutputStream dst;
6365
encoder.Encode(values.data(), values.size(), &dst);
6466
}
67+
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(int64_t));
6568
}
6669

6770
BENCHMARK(BM_PlainEncodingInt64)->Range(1024, 65536);
@@ -78,6 +81,7 @@ static void BM_PlainDecodingInt64(::benchmark::State& state) {
7881
decoder.SetData(values.size(), buf->data(), buf->size());
7982
decoder.Decode(values.data(), values.size());
8083
}
84+
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(int64_t));
8185
}
8286

8387
BENCHMARK(BM_PlainDecodingInt64)->Range(1024, 65536);

0 commit comments

Comments
 (0)