Skip to content

Conversation

@JonasNorlinder
Copy link
Member

@JonasNorlinder JonasNorlinder commented Dec 12, 2025

CPUTimeCounters unconditionally creates CPUTimeGroups::CPUTimeType::gc_total. Since only Parallel and G1 are supported by this framework/class, this leads to publishing a counter that always resolves to 0. This may be contradictory for an end-user especially so as we now support logging GC CPU time for any GC inside Hotspot. For an example using -XX:+UseZGC -Xlog:cpu we get

[7.907s][info][cpu] === CPU time Statistics =============================================================
[7.907s][info][cpu]                                                                             CPUs
[7.907s][info][cpu]                                                                s       %  utilized
[7.907s][info][cpu]    Process
[7.907s][info][cpu]      Total                                              186.9562  100.00      23.6
[7.907s][info][cpu]      Garbage Collection                                   0.6700    0.36       0.1
[7.907s][info][cpu]        GC Threads                                         0.6692    0.36       0.1
[7.907s][info][cpu]        VM Thread                                          0.0008    0.00       0.0
[7.907s][info][cpu] =====================================================================================

But jcmd $(pgrep -n java) PerfCounter.print | grep -E "sun.threads.total_gc_cpu_time" prints: sun.threads.total_gc_cpu_time=0.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8373625: CPUTimeCounters creates a total counter for unsupported GCs (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28803/head:pull/28803
$ git checkout pull/28803

Update a local copy of the PR:
$ git checkout pull/28803
$ git pull https://git.openjdk.org/jdk.git pull/28803/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28803

View PR using the GUI difftool:
$ git pr show -t 28803

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28803.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 12, 2025

👋 Welcome back jnorlinder! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 12, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Dec 12, 2025
@openjdk
Copy link

openjdk bot commented Dec 12, 2025

@JonasNorlinder The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@JonasNorlinder
Copy link
Member Author

/label add hotspot-gc serviceability

@JonasNorlinder
Copy link
Member Author

/label remove hotspot-runtime

@openjdk openjdk bot added hotspot-gc hotspot-gc-dev@openjdk.org serviceability serviceability-dev@openjdk.org labels Dec 12, 2025
@openjdk
Copy link

openjdk bot commented Dec 12, 2025

@JonasNorlinder
The hotspot-gc label was successfully added.

The serviceability label was successfully added.

@openjdk openjdk bot removed the hotspot-runtime hotspot-runtime-dev@openjdk.org label Dec 12, 2025
@openjdk
Copy link

openjdk bot commented Dec 12, 2025

@JonasNorlinder
The hotspot-runtime label was successfully removed.

@JonasNorlinder JonasNorlinder marked this pull request as ready for review December 12, 2025 21:35
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 12, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 12, 2025

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-gc hotspot-gc-dev@openjdk.org rfr Pull request is ready for review serviceability serviceability-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

1 participant