RFR: 8349476: G1: Regularly print CPU usage by thread type
Thomas Schatzl
tschatzl at openjdk.org
Wed Feb 12 17:46:14 UTC 2025
On Wed, 12 Feb 2025 11:52:50 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
> Hi all,
>
> please review this change to print total cpu usage per worker thread group every gc (with `gc+cpu=debug`) to have a better overview about which threads are taking how much CPU.
>
> I considered merging with the gc worker perfcounter update close by, but the opportunity to share code is very little, and the resulting code would be riddled with checking whether the perf counters should be updated or not.
>
> I.e. the only shared code would be the closure with a one-liner calling `os::thread_cpu_time()`; most other code would be different, e.g. determining whether to update the perf counters or not, the actual log messages etc.
>
> Tell me if you think I should try harder to do so.
>
> Testing: gha
>
> Thanks,
> Thomas
Another alternative is just not doing this change: this information can be retrieved using the VM performance counters (and sufficient for the purposes I need it) too, although only available if `-XX:+UsePerfData` is enabled.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23585#issuecomment-2654432360
More information about the hotspot-gc-dev
mailing list