MCPcopy Create free account
hub / github.com/apache/impala / DoBenchmark

Method DoBenchmark

be/src/kudu/util/jsonwriter-test.cc:178–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void TestJsonWriter::DoBenchmark(const Message& pb) {
179 int64_t total_len = 0;
180 Stopwatch sw;
181 sw.start();
182 while (sw.elapsed().wall_seconds() < 5) {
183 std::ostringstream str;
184 JsonWriter jw(&str, JsonWriter::COMPACT);
185 jw.StartArray();
186 for (int i = 0; i < 10000; i++) {
187 jw.Protobuf(pb);
188 }
189 jw.EndArray();
190 total_len += str.str().size();
191 }
192 sw.stop();
193 double mbps = total_len / 1024.0 / 1024.0 / sw.elapsed().user_cpu_seconds();
194 LOG(INFO) << "Throughput: " << mbps << "MB/sec";
195}
196
197TEST_F(TestJsonWriter, BenchmarkAllTypes) {
198 DoBenchmark(MakeAllTypesPB());

Callers

nothing calls this directly

Calls 10

wall_secondsMethod · 0.80
elapsedMethod · 0.80
ProtobufMethod · 0.80
user_cpu_secondsMethod · 0.80
startMethod · 0.65
stopMethod · 0.65
StartArrayMethod · 0.45
EndArrayMethod · 0.45
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected