Skip to content

Commit 4c73217

Browse files
committed
Make instructions / cycle counters more useful
1 parent 8d3ffb9 commit 4c73217

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

benchmark/parse_records_benchmark.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ template<typename B, typename R> static void ParseRecordsBenchmark(benchmark::St
1919
for (SIMDJSON_UNUSED auto _ : state) {
2020
if (!bench.Run(json)) { state.SkipWithError("tweet reading failed"); return; }
2121
}
22-
state.SetBytesProcessed(json.size() * state.iterations());
22+
auto bytes = json.size() * state.iterations();
23+
state.SetBytesProcessed(bytes);
2324
state.SetItemsProcessed(bench.Records().size() * state.iterations());
2425
auto counts = events.end();
2526
if (events.has_events()) {
26-
state.counters["Instructions"] = counts.instructions();
27-
state.counters["Cycles"] = counts.cycles();
28-
state.counters["Branch Misses"] = counts.branch_misses();
29-
state.counters["Cache References"] = counts.cache_references();
30-
state.counters["Cache Misses"] = counts.cache_misses();
27+
state.counters["Ins./Byte"] = double(counts.instructions()) / double(bytes);
28+
state.counters["Ins./Cycle"] = double(counts.instructions()) / double(counts.cycles());
29+
state.counters["Cycles/Byte"] = double(counts.cycles()) / double(bytes);
30+
state.counters["BranchMiss"] = benchmark::Counter(counts.branch_misses(), benchmark::Counter::kAvgIterations);
31+
state.counters["CacheMiss"] = benchmark::Counter(counts.cache_misses(), benchmark::Counter::kAvgIterations);
32+
state.counters["CacheRef"] = benchmark::Counter(counts.cache_references(), benchmark::Counter::kAvgIterations);
3133
}
3234
}

0 commit comments

Comments
 (0)