RFR: 8308643: Incorrect value of 'used' jvmstat counter

Albert Mingkun Yang ayang at openjdk.org
Tue May 30 14:01:59 UTC 2023


On Tue, 30 May 2023 13:52:21 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> src/hotspot/share/gc/parallel/spaceCounters.hpp line 42:
>> 
>>> 40:   PerfVariable*      _capacity;
>>> 41:   PerfVariable*      _used;
>>> 42:   volatile size_t    _last_used_in_bytes;
>> 
>> Why is an additional field required here? Can't `_used` fulfill the purpose?
>
> The _used counters only seem to be updated by GCs.  The take_sample function reports "current" data.

Can `take_sample` update `_used` instead? IOW, what's the fundamental reason for having two distinct counters here?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14195#discussion_r1210320579


More information about the hotspot-gc-dev mailing list