Skip to content

Conversation

@jmr
Copy link
Member

@jmr jmr commented Aug 21, 2023

Previously, counters was updated in PauseTiming() with
counters[name] += Counter(measurement, kAvgIteration).

The first counters[name] call inserts a counter with no flags.

There is no operator+= for Counter, so the insertion is done
by converting the Counter to a double, then constructing a
Counter to insert from the double, which drops the flags.

Pre-insert the Counter with the correct flags, then only
update Counter::value.

Introduced in 1c64a36 ([perf-counters] Fix pause/resume (#1643)).

jmr added 2 commits August 21, 2023 13:11
Previously, `counters` was updated in `PauseTiming()` with
`counters[name] += Counter(measurement, kAvgIteration)`.

The first `counters[name]` call inserts a counter with no flags.

There is no `operator+=` for `Counter`, so the insertion is done
by converting the `Counter` to a `double`, then constructing a
`Counter` to insert from the `double`, which drops the flags.

Pre-insert the `Counter` with the correct flags, then only
update `Counter::value`.

Introduced in 1c64a36 ([perf-counters] Fix pause/resume (google#1643)).
Perf counters are now divided by iterations, so dividing again
in the test is wrong.
@jmr
Copy link
Member Author

jmr commented Aug 21, 2023

@mtrofin

@jmr
Copy link
Member Author

jmr commented Aug 21, 2023

I'm not sure why most of the sanitizer tests are failing.

The history on my branch is getting out of control. This should be squashed-and-merged when it's ready.

@dmah42
Copy link
Member

dmah42 commented Aug 21, 2023

I'm not sure why most of the sanitizer tests are failing.

they're passing at head, i'm not sure why your change would break them.. only thing i can think (as it's coming from __assert) is that you're referencing assert without including but that seems like an unlikely issue...

The history on my branch is getting out of control. This should be squashed-and-merged when it's ready.

it will be.. always do the squash when i merge :)

@jmr
Copy link
Member Author

jmr commented Aug 21, 2023

Can you trigger the presubmits on HEAD? I wonder if something changed with the sanitizer setup.

@dmah42
Copy link
Member

dmah42 commented Aug 21, 2023

Can you trigger the presubmits on HEAD? I wonder if something changed with the sanitizer setup.

yeah they're failing for changes to documents

@mtrofin
Copy link
Contributor

mtrofin commented Aug 21, 2023

Thanks for fixing this. I forgot how Counter worked and assumed they are collected "in total" by design. Thanks!

@dmah42 dmah42 merged commit e739156 into google:main Aug 21, 2023
@jmr jmr deleted the jmr-state-init-perf-counters branch August 24, 2023 09:05
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.

3 participants