Integrated: 8364638: Refactor and make accumulated GC CPU time code generic
Jonas Norlinder
duke at openjdk.org
Thu Aug 21 14:08:05 UTC 2025
On Mon, 4 Aug 2025 13:59:43 GMT, Jonas Norlinder <duke at openjdk.org> wrote:
> Hi all,
>
> This PR refactors the newly added GC CPU time code from [JDK-8359110](https://bugs.openjdk.org/browse/JDK-8359110).
>
> As a stepping-stone to enable consolidation of CPU time tracking in e.g. hsperf counters and GCTraceCPUTime and to have a unified interface for tracking CPU time of various components in Hotspot this code can be refactored. This PR introduces a new interface to retrieve CPU time for various Hotspot components and it currently supports:
>
> CPUTimeUsage::GC::total() // the sum of gc_threads(), vm_thread(), stringdedup()
>
> CPUTimeUsage::GC::gc_threads()
> CPUTimeUsage::GC::vm_thread()
> CPUTimeUsage::GC::stringdedup()
>
>
> I moved `CPUTimeUsage` to `src/hotspot/share/services` since it seemed fitting as it housed similar performance tracking code like `RuntimeService`, as this is no longer a class that is only specific to GC.
>
> I also made a minor improvement in the CPU time logging during exit. Since `CPUTimeUsage` supports more components than just GC I changed the logging flag to from `gc,cpu` to `cpu` and created a detailed table:
>
>
> [71.425s][info][cpu ] === CPU time Statistics =============================================================
> [71.425s][info][cpu ] CPUs
> [71.425s][info][cpu ] s % utilized
> [71.425s][info][cpu ] Process
> [71.425s][info][cpu ] Total 1616.3627 100.00 22.6
> [71.425s][info][cpu ] Garbage Collection 83.7322 5.18 1.2
> [71.425s][info][cpu ] GC Threads 82.7671 5.12 1.2
> [71.425s][info][cpu ] VM Thread 0.9651 0.06 0.0
> [71.425s][info][cpu ] =====================================================================================
This pull request has now been integrated.
Changeset: fb651fd6
Author: Jonas Norlinder <jonas.norlinder at oracle.com>
Committer: Albert Mingkun Yang <ayang at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/fb651fd6d246e69b42363e050eb8d96afb633eed
Stats: 281 lines in 11 files changed: 202 ins; 76 del; 3 mod
8364638: Refactor and make accumulated GC CPU time code generic
Reviewed-by: ayang, sjohanss
-------------
PR: https://git.openjdk.org/jdk/pull/26621
More information about the hotspot-dev
mailing list