google / benchmark

A microbenchmark support library
Apache License 2.0
8.69k stars 1.59k forks source link

Fix edge case while filtering performance counters #1557

Closed HFTrader closed 1 year ago

HFTrader commented 1 year ago

Even though we filter out bad performance counter names, it might still be the case where a PMC cannot be allocated due to system limits (eg perf_event_open returns -1 for any reason). In this case, the current implementation will drop the entire performance counter set.

Instead, filter out the failing PMC and warn the user. This was the behavior previously subject to a PR but this case slipped in, inherited.

The test for this fix is reflected in test/perf_counters_gtest.cpp under PerfCountersTest::NegativeTest.

HFTrader commented 1 year ago

I'm confused why the merge conflicts. I branched out of main and it does not seem to have been updated. Please disregard.

HFTrader commented 1 year ago

Bad merge. Please disregard.