Skip to content

Conversation

@HFTrader
Copy link
Contributor

@HFTrader HFTrader commented Mar 4, 2023

The main feature in this pull request is the removal of the static sharing of PerfCounters and instead creating them at the top RunBenchmarks() function where all benchmark runners are created. A single PerfCountersMeasurement object is created and then shared with all the new BenchmarkRunners objects, one per existing benchmark.

Other features conflated here in this PR are:

  • Added BENCHMARK_DONT_OPTIMIZE macro in global scope
  • Removal of the IsValid() query, being replaced by checking the number of remaining counters after validity tests
  • Refactoring of all GTests to reflect the changes and new semantics
  • extra comments throughout the new code to clarify intent
  • fix a harmless issue where the Create() method would invalidate the entire set of counters if one of them failed to open after being validated

It was truly impossible to separate all those features in different PRs as requested since they are so interdependent on each other so I'm just pushing them together and asking for forgiveness.

This PR comes replacing PRs 1555 and 1558 which have been closed.

The main feature in this pull request is the removal of the static
sharing of PerfCounters and instead creating them at the top
`RunBenchmarks()`  function where all benchmark runners are created. A
single PerfCountersMeasurement object is created and then shared with
all the new BenchmarkRunners objects, one per existing benchmark.

Other features conflated here in this PR are:
- Added BENCHMARK_DONT_OPTIMIZE macro in global scope
- Removal of the `IsValid()` query, being replaced by checking the
  number of remaining counters after validity tests
- Refactoring of all GTests to reflect the changes and new semantics
- extra comments throughout the new code to clarify intent

It was extremely hard to separate all those features in different PRs
as requested since they are so interdependent on each other so I'm just
pushing them altogether and asking for forgiveness.

This PR comes replacing PRs 1555 and 1558 which have been closed.
My clang-format insists in deleting this single white space on line 601
while Github's clang format breaks when it is added. I had to disable
format-on-save to check-in this revert change.
I'm using clang 14.0.6.
@HFTrader
Copy link
Contributor Author

HFTrader commented Mar 4, 2023

The Bazel failures dont seem related to code. What to do?

@dmah42
Copy link
Member

dmah42 commented Mar 6, 2023

rerunning the osx one, that looks like a local failure. the windows one seems like some timings changed away from expectations. that shouldn't be related to this PR. i'l try rerunning that too.

@mtrofin
Copy link
Contributor

mtrofin commented Mar 6, 2023

lgtm, some nits

@HFTrader
Copy link
Contributor Author

HFTrader commented Mar 7, 2023

rerunning the osx one, that looks like a local failure. the windows one seems like some timings changed away from expectations. that shouldn't be related to this PR. i'l try rerunning that too.

Maybe because some tests are now running in full while before they were being collapsed by the compiler?

@dmah42 dmah42 merged commit fbc6efa into google:main Mar 7, 2023
@dmah42
Copy link
Member

dmah42 commented Mar 7, 2023

thanks for all the iterations :D

reports_for_family = &per_family_reports[benchmark.family_index()];

runners.emplace_back(benchmark, reports_for_family);
benchmarks_with_threads += (benchmark.threads() > 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is always true. Should it be threads() > 1?

jmr added a commit to jmr/benchmark that referenced this pull request Aug 17, 2023
Change condition for `benchmarks_with_threads` from `benchmark.threads() > 0` to `> 1`.  `threads()` appears to always be `>= 1`.

Introduced in fbc6efa (Refactoring of PerfCounters infrastructure (google#1559))
jmr added a commit to jmr/benchmark that referenced this pull request Aug 17, 2023
Change condition for `benchmarks_with_threads` from `benchmark.threads() > 0` to `> 1`.  `threads()` appears to always be `>= 1`.

Introduced in fbc6efa (Refactoring of PerfCounters infrastructure (google#1559))
dmah42 pushed a commit that referenced this pull request Aug 17, 2023
Change condition for `benchmarks_with_threads` from `benchmark.threads() > 0` to `> 1`.  `threads()` appears to always be `>= 1`.

Introduced in fbc6efa (Refactoring of PerfCounters infrastructure (#1559))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants