RFR: 8368527: JMX: Add an MXBeans method to query GC CPU time [v8]

Jonas Norlinder duke at openjdk.org
Sun Oct 26 15:13:04 UTC 2025


On Sun, 26 Oct 2025 14:17:33 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> This test will need re-work.

The end-goal of this test was to verify that the implementation correctly guarded against races during shutdown which it manged to test. So to that end I'm not sure this particular test needs re-work as it correctly manages to run Java code that races on this method during VM shutdown. However, if I understand your comment you are suggesting that we should (1) simplify how the test is invoked (2) add a test for checking that the value is monotonically increasing. For the latter I did not add such test as we in the end rely on`os::thread_cpu_time`.

> `GC cpu time is <= process cpu time`

I think we are at the mercy of how well the underlying OS update thread CPU time. I know that for extremely short-lived processes, the accounting for CPU time may be less reliable at least on Linux. In general, can Hotspot make any guarantee about CPU time for threads vs process CPU time?

> What is the reason for launching a sub-process? 

I looked at other tests how they launched tests for different GCs and that's the way I found to achieve that. If `@requires` is another way and is the preferred one I can change.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27537#discussion_r2463870835


More information about the serviceability-dev mailing list