Skip to content

Add JFR GC Heap Summary event - #23652

Merged
tajila merged 1 commit into
eclipse-openj9:masterfrom
adpopescu:jfr-gc-heap-summary
May 21, 2026
Merged

Add JFR GC Heap Summary event#23652
tajila merged 1 commit into
eclipse-openj9:masterfrom
adpopescu:jfr-gc-heap-summary

Conversation

@adpopescu

Copy link
Copy Markdown
Contributor

This change adds the JFR GC Heap summary event. It is emitted at both cycle start and cycle end.

@adpopescu

Copy link
Copy Markdown
Contributor Author

Testing: test jfr GCHeapSummary - approx 30 seconds
Test start time: 2026/04/06 16:13:05 Pacific Standard Time
Running command: /home/test/openj9-openjdk-jdk17/build/linux-x86_64-server-slowdebug/images/jdk/bin/jfr print --xml --events "GCHeapSummary" defaultJ9recording.jfr
Time spent starting: 3 milliseconds
Time spent executing: 439 milliseconds
Test result: PASSED

---TEST RESULTS---
Number of PASSED tests: 17 out of 17
Number of FAILED tests: 0 out of 17

cmdLineTester_jfrEvents_0_PASSED

@adpopescu
adpopescu force-pushed the jfr-gc-heap-summary branch from a8a794e to 25becdd Compare April 7, 2026 02:31
@adpopescu

Copy link
Copy Markdown
Contributor Author

@amicic, @TobiAjila please review

@adpopescu
adpopescu force-pushed the jfr-gc-heap-summary branch from 25becdd to 0c69530 Compare April 7, 2026 16:34
Comment thread runtime/vm/jfr.cpp Outdated

/* Populate virtual space fields */
jfrEvent->vStart = (U_64)(uintptr_t)heapBase;
jfrEvent->vCommittedEnd = (U_64)(uintptr_t)heapTop;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what's the intention of vCommittedEnd, but in general committed and uncommitted memory can be interleaved (especially true with Balanced GC with Offheap, but to a small degree even in Gencon), but this (heapTop) is probably a good enough simple answer as a start.

Comment thread runtime/vm/jfr.cpp
jfrEvent->vStart = (U_64)(uintptr_t)heapBase;
jfrEvent->vCommittedEnd = (U_64)(uintptr_t)heapTop;
jfrEvent->vCommittedSize = (U_64)heapSize;
jfrEvent->vReservedEnd = (U_64)(uintptr_t)heapTop;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, for Balanced GC with Offheap, reserved start and end that you get from the our API do not account for Offheap
but for a start, let's not worry about that

Comment thread runtime/vm/jfr.cpp
jfrEvent->gcWhenID = gcWhenID; /* BeforeGC or AfterGC */

/* Get heap information from memory manager */
void *heapBase = javaVM->memoryManagerFunctions->j9gc_get_heap_base(javaVM);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are the local variables needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's so that I don't have to go fetch them through the memory manager functions again. The values are used in a couple places. Also, just to be consistent i.e. freeMemory and heapBase don't need them but consistency.

@tajila

tajila commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

jenkins test sanity.functional xlinux jdk17

@tajila

tajila commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

jenkins test extended.functional alinux64 jdk21

@adpopescu
adpopescu marked this pull request as ready for review April 7, 2026 19:25
"concurrent kickoff"
};

static constexpr const char * const gcWhens[] = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be "Before GC" and "After GC" case sensitive as JMC keys on this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@adpopescu
adpopescu force-pushed the jfr-gc-heap-summary branch from 0c69530 to 52a77c4 Compare April 8, 2026 12:34
@tajila

tajila commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

jenkins test sanity.functional xlinux jdk17

@tajila

tajila commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@adpopescu Have you verified that the data makes sense with something like verbose GC logs?

@adpopescu

Copy link
Copy Markdown
Contributor Author

You mean for the actual sizes or for the heap addresses? I didn't compare them directly since they are essentially using the same values more or less? I do want to make a couple more changes to the values though now that you mention it. I went back and rechecked some of the values and I think they should be slightly different.

@tajila

tajila commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

I wasnt sure about the output I was seeing in JMC thats why I asked.

@tajila tajila mentioned this pull request Apr 16, 2026
3 tasks
This change adds the JFR GC Heap summary event. It is emitted at both
cycle start and cycle end.

Signed-off-by: Adrian Popescu <adpopescu@ibm.com>
@adpopescu
adpopescu force-pushed the jfr-gc-heap-summary branch from 52a77c4 to 96405bb Compare April 23, 2026 17:56
@tajila

tajila commented May 11, 2026

Copy link
Copy Markdown
Contributor

@adpopescu Have you had a chance to verify this behaves similar to GC verbose logs?

@adpopescu

adpopescu commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

I'm investigating an issue that is only showing up on metronome. Need to make sure it's unrelated to the changes. It's a runtime exception so I have to check it before we can merge anything in.

@tajila

tajila commented May 19, 2026

Copy link
Copy Markdown
Contributor

jenkins test sanity.functional xlinux jdk17

@adpopescu

adpopescu commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

@tajila The issue with metronome seems unrelated to this change. Also, yes I checked the values against verbose gc and they are the same. This should be good to go now.

@tajila

tajila commented May 20, 2026

Copy link
Copy Markdown
Contributor

jenkins test sanity.functional xlinux jdk17

@tajila
tajila merged commit 19c14ce into eclipse-openj9:master May 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants