RFR: 8308643: Incorrect value of 'used' jvmstat counter
Kim Barrett
kbarrett at openjdk.org
Wed Jun 14 21:59:58 UTC 2023
On Wed, 14 Jun 2023 21:55:27 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Can `take_sample` update `_used` instead? IOW, what's the fundamental reason for having two distinct counters here?
>
> Using the perf-counter to carry the periodic samples doesn't work. During
> construction of the perf-counter, the sampler is called to provide the initial
> value for the counter. Since the counter is not yet fully constructed and
> accessible to the sampling function (_used is not yet initialized), this crashes.
>
> A workaround for that problem would be to add constructors that take both a
> sampler and an initial value. That's kind of messy, and doesn't seem better
> than the proposed solution at hand.
BTW, I was wrong about the _used counter only being updated by GC. It is
updated by the sampler to the newly sampled value. I hadn't fully chased
through the call chains before.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14195#discussion_r1230210856
More information about the hotspot-gc-dev
mailing list