RFR: 8315149: Add hsperf counters for CPU time of internal GC threads [v24]

David Holmes dholmes at openjdk.org
Fri Sep 22 03:31:18 UTC 2023


On Fri, 22 Sep 2023 00:11:19 GMT, Man Cao <manc at openjdk.org> wrote:

>> src/hotspot/share/gc/shared/collectedHeap.cpp line 161:
>> 
>>> 159: }
>>> 160: 
>>> 161: void CollectedHeap::inc_total_cpu_time(long diff) {
>> 
>> We don't use `long` in shared code as it has different size on different platforms.
>
> Using `long` is to avoid build failure on 32-bit ARM and x86. `jlong` is `long long` on 32-bit, and Atomic template does not support `long long` on 32-bit. Example failure: https://github.com/jjoo172/jdk/actions/runs/6229455243/job/16907994694.
> 
> Is there a better way to avoid these failures on 32-bit?

`long` is 32-bit on Windows x64 as well which means you're reducing the utility of these timers there (else you could use 32-bit everywhere).

AFAICS it should be supported on x86-32 as we define `SUPPORTS_NATIVE_CX8` whilst for ARM it is restricted to ARMv7a and above. (Does anyone build ARMv6 still?) But that appears not to be handled by the atomic templates.

Not sure the best way to approach this one. If the templates correctly handled SUPPORTS_NATIVE_CX8 to define the 64-bit variants then the ideal solution would be to use a typedef that is 64-bit on supported platforms and 32-bit elsewhere.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15082#discussion_r1333838798


More information about the serviceability-dev mailing list