aboutsummaryrefslogtreecommitdiff
path: root/src/benchmark_runner.cc
diff options
context:
space:
mode:
authorLiqiang TAO <taolq@outlook.com>2022-01-25 19:14:20 +0900
committerGitHub <noreply@github.com>2022-01-25 10:14:20 +0000
commitd0fbf8ac238d3bc3a111334ab3553173812d78e7 (patch)
tree589bdc6d72203e72080ad9b3e128f8d4ce9580b0 /src/benchmark_runner.cc
parent57b2bfa33bbc4f171a7fc2807de71583b1e2fd2a (diff)
downloadgoogle-benchmark-d0fbf8ac238d3bc3a111334ab3553173812d78e7.tar.gz
Cache PerfCounters instance in PerfCountersMeasurement (#1308)
This patch fixes #1306, by reducing the pinned instances of PerfCounters. The issue is caused by creating multiple pinned events in the same thread, doing so results in the Snapshot(PerfCounterValues* values) failing, and that's now discoverable. Creating multile pinned events is an unsupported behavior currently. The error would be detected at read() time, not perf_event_open() / iotcl() time. The unsupported benavior above is confirmed by Stephane Eranian @seranian, and he also pointed the dectection method. Finished this patch under the guidance of Mircea Trofin @mtrofin.
Diffstat (limited to 'src/benchmark_runner.cc')
-rw-r--r--src/benchmark_runner.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc
index eac807b..ec7c127 100644
--- a/src/benchmark_runner.cc
+++ b/src/benchmark_runner.cc
@@ -152,8 +152,7 @@ BenchmarkRunner::BenchmarkRunner(
has_explicit_iteration_count(b.iterations() != 0),
pool(b.threads() - 1),
iters(has_explicit_iteration_count ? b.iterations() : 1),
- perf_counters_measurement(
- PerfCounters::Create(StrSplit(FLAGS_benchmark_perf_counters, ','))),
+ perf_counters_measurement(StrSplit(FLAGS_benchmark_perf_counters, ',')),
perf_counters_measurement_ptr(perf_counters_measurement.IsValid()
? &perf_counters_measurement
: nullptr) {