JDK-8318937 : Replace G1ConcurrentMarkThread::vtime_accum() with same value for sun.threads.cpu_time.gc_conc_mark
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 22
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2023-10-26
  • Updated: 2025-06-26
  • Resolved: 2025-06-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
JDK-8315149 added an hsperf counter `sun.threads.cpu_time.gc_conc_mark`. As mentioned in https://github.com/openjdk/jdk/pull/15082, the existing G1ConcurrentMarkThread::vtime_accum() and G1ConcurrentMarkThread::vtime_mark_accum() are only used in logging, and serve a similar purpose as the sun.threads.cpu_time.gc_conc_mark counter. Moreover, os::elapsedVTime() could be either CPU time or wall time, depending on the platform, which could be confusing to users.

It would be cleaner to replace the use cases of G1ConcurrentMarkThread::vtime_accum() and G1ConcurrentMarkThread::vtime_mark_accum() with the same underlying value as sun.threads.cpu_time.gc_conc_mark.
Comments
JDK-8274051 changes the uses of the *vtime methods/members to directly use os::thread_cpu_time() which the jstat counters already use. So they will be equivalent.
26-06-2025

Thanks for the feedback. Revised.
31-10-2023

[~kbarrett] yes but where it does not exist wall time is always used. My point is that in practice we do not get a "silent fallback" from CPU time to wall time.
30-10-2023

getrusage doesn't exist on some platforms, such as BSD / Apple. See also JDK-8274051.
27-10-2023

> os::elapsedVTime() could silently fall back from CPU time to wall time Not really - getrusage can't fail in practice.
27-10-2023