RFR: 8330677: Add Per-Compilation memory usage to JFR [v2]
Matthias Baesken
mbaesken at openjdk.org
Mon Apr 29 10:46:08 UTC 2024
On Fri, 26 Apr 2024 12:40:00 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> We have the (opt-in, disabled by default) compiler memory statistics introduced with [JDK-8317683](https://bugs.openjdk.org/browse/JDK-8317683).
>>
>> Since temporary memory usage by compilers can significantly affect process footprint, it would make sense to expose at least the total peak usage per compilation via JFR.
>>
>> ---
>>
>> This patch adds "Arena Usage" to CompilationEvent. We now see in JMC how costly a compilation had been. (The cost can get very high, as we have seen just recently again with [JDK-8327247](https://bugs.openjdk.org/browse/JDK-8327247) ).
>>
>> ![jmc-memstat](https://github.com/openjdk/jdk/assets/6041414/8cac366a-2a8f-45ca-be40-d419712f81a7)
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>
> - Adapt test
> - merge
> - JDK-8330677-Add-Per-Compilation-memory-usage-to-JFR
Marked as reviewed by mbaesken (Reviewer).
src/hotspot/share/compiler/compilationMemoryStatistic.cpp line 397:
> 395: CompilerThread* const th = Thread::current()->as_Compiler_thread();
> 396: ArenaStatCounter* const arena_stat = th->arena_stat();
> 397: CompileTask* const task = th->task();
At some places we check the result for nullptr e.g.
https://github.com/openjdk/jdk/blob/b3bcc49491b8f8ad337eb4c06201a5468e5c1159/src/hotspot/share/compiler/compilationMemoryStatistic.cpp#L79
Is that over cautious or should it better be done ?
src/hotspot/share/compiler/compileTask.hpp line 117:
> 115: // Specifies if _failure_reason is on the C heap.
> 116: bool _failure_reason_on_C_heap;
> 117: size_t _arena_bytes; // peak size of temporary memory during compilation (e.g. node arenas)
Is there a good reason not to name it _peak_arena_bytes when it is always the peak as stated ?
src/hotspot/share/jfr/metadata/metadata.xml line 611:
> 609: <Field type="ulong" contentType="bytes" name="codeSize" label="Compiled Code Size" />
> 610: <Field type="ulong" contentType="bytes" name="inlinedBytes" label="Inlined Code Size" />
> 611: <Field type="ulong" contentType="bytes" name="arenaBytes" label="Arena Usage" />
Maybe say Peak arena usage, if this is the case as stated above ?
And some info that it is optional / must be enabled to see this data would probably help too.
-------------
PR Review: https://git.openjdk.org/jdk/pull/18864#pullrequestreview-2024243499
PR Review Comment: https://git.openjdk.org/jdk/pull/18864#discussion_r1580553526
PR Review Comment: https://git.openjdk.org/jdk/pull/18864#discussion_r1580563005
PR Review Comment: https://git.openjdk.org/jdk/pull/18864#discussion_r1580566235
More information about the hotspot-compiler-dev
mailing list