RFR: 8359110: Log accumulated GC and process CPU time upon VM exit [v19]

Albert Mingkun Yang ayang at openjdk.org
Thu Jul 3 10:45:46 UTC 2025


On Thu, 3 Jul 2025 10:24:40 GMT, Jonas Norlinder <duke at openjdk.org> wrote:

>> Add support to log CPU cost for GC during VM exit with `-Xlog:gc+cpu`.
>> 
>> 
>> [2,430s][info][gc,cpu] GC CPU usage: 22,87% (Process: 26,8926s GC: 6,1491s)
>
> Jonas Norlinder has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove friend class in CPUTimeCounters

src/hotspot/share/gc/shared/collectedHeap.hpp line 465:

> 463: 
> 464:   double elapsed_gc_cpu_time() const;
> 465:   void log_gc_cpu_time() const;

They can be private, I believe.

src/hotspot/share/gc/shared/stringdedup/stringDedup.hpp line 109:

> 107: #include "utilities/globalDefinitions.hpp"
> 108: 
> 109: class CollectedHeap;

Should not be necessary given the included header.

src/hotspot/share/gc/shared/stringdedup/stringDedupProcessor.hpp line 33:

> 31: #include "utilities/macros.hpp"
> 32: 
> 33: class CollectedHeap;

Should not be necessary given the included header.

src/hotspot/share/gc/shared/vmThreadCpuTimeScope.hpp line 37:

> 35:   bool    _enabled;
> 36:   bool    _is_gc_operation;
> 37:   Thread* _thread;

If this class is solely for vmthread, I guess using the more concrete type `VMThread` here seems more explicit.

src/hotspot/share/runtime/cpuTimeCounters.hpp line 36:

> 34: #include "runtime/perfDataTypes.hpp"
> 35: 
> 36: class VMThreadCPUTimeScope;

Seems unused.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2182436622
PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2182460139
PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2182460302
PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2182449653
PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2182438065


More information about the hotspot-gc-dev mailing list