-
Notifications
You must be signed in to change notification settings - Fork 162
Fix "No Detail" Use Cases for Legacy and Generational ZGC logging #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jlittle-ptc
wants to merge
3
commits into
microsoft:main
Choose a base branch
from
jlittle-ptc:ZGC-NoDetailRebase
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,17 +194,33 @@ private void setForwardRefForPhase(ZGCPhase zgcPhase, ZGCForwardReference forwar | |
|
||
private void cycleStart(GCLogTrace trace, String s) { | ||
ZGCCycleType type = ZGCCycleType.get(trace.getGroup(2)); | ||
|
||
if (diary.isGenerationalZGC()) { | ||
// cycleStart ends up being called for ZGC logging with no details, but did not handle this situation. | ||
// It is not clear if there is any differentiation between Young/Old Phases in no-details logging, so I've made | ||
// an assumption here that we're strictly dealing with Young collections until we have sample logging otherwise. | ||
if (ZGCCycleType.MAJOR.equals(type)) { | ||
setForwardRefForPhase( | ||
ZGCPhase.MAJOR_YOUNG, | ||
new ZGCForwardReference(getClock(), trace.getLongGroup(1), trace.gcCause(3,0), type, ZGCPhase.MAJOR_YOUNG)); | ||
} else if (ZGCCycleType.MINOR.equals(type)) { | ||
setForwardRefForPhase( | ||
ZGCPhase.MINOR_YOUNG, | ||
new ZGCForwardReference(getClock(), trace.getLongGroup(1), trace.gcCause(3,0), type, ZGCPhase.MINOR_YOUNG)); | ||
} | ||
|
||
} | ||
|
||
if(type == ZGCCycleType.FULL){ | ||
setForwardRefForPhase( | ||
ZGCPhase.FULL, | ||
new ZGCForwardReference(getClock(), trace.getLongGroup(1), trace.gcCause(3,0), type, ZGCPhase.FULL) | ||
); | ||
} | ||
else { | ||
} else { | ||
// The cycle start message gives us the gc cause, which we need to create the GCEvent in generationStart | ||
// When we get a cycle start, store the gc cause for later use | ||
gcCauseMap.put(trace.getLongGroup(1), trace.gcCause(1, 2)); | ||
} | ||
} | ||
} | ||
|
||
private void generationStart(GCLogTrace trace, String line){ | ||
|
@@ -549,11 +565,39 @@ private void generationEnd(GCLogTrace trace, String s) { | |
} | ||
|
||
private void memorySummary(GCLogTrace trace, String s) { | ||
if(diary.isGenerationalZGC()){ | ||
if (diary.isGenerationalZGC()) { | ||
long gcId = trace.getLongGroup(1); | ||
gcCauseMap.remove(gcId); | ||
|
||
if (gcCauseMap.containsKey(gcId)) { | ||
gcCauseMap.remove(gcId); | ||
} | ||
|
||
// We use the lack of a MemorySummary in the forwardReference as a sign that this is the case and | ||
// that we need to publish a Generational no-details event. | ||
ZGCCycleType type = ZGCCycleType.get(trace.getGroup(2)); | ||
ZGCForwardReference forwardReference = ZGCCycleType.MAJOR.equals(type) ? | ||
getForwardRefForPhase(ZGCPhase.MAJOR_YOUNG) : | ||
getForwardRefForPhase(ZGCPhase.MINOR_YOUNG); | ||
|
||
if (forwardReference != null && !forwardReference.hasMemorySummary()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpcik, but I have a slight preference for putting that logic into a function that effectively says what you said in the comment. e.g. Not the hill I'm going to die on though :-) // Comment |
||
forwardReference.setMemorySummary( | ||
new ZGCMemorySummary( | ||
trace.toKBytes(4), | ||
trace.toKBytes(7))); | ||
publish(forwardReference.getGCEVent(getClock())); | ||
} | ||
} else { | ||
ZGCForwardReference forwardReference = getForwardRefForPhase(ZGCPhase.FULL); | ||
|
||
// For Legacy ZGC (Java 17, non-generational) with no details (gc instead of gc*), only a single line | ||
// is logged per event. As such, getForwardRefForPhase will return NULL. | ||
if (forwardReference == null) { | ||
// Forward reference has not yet been created, so we'll create it now | ||
ZGCCycleType type = ZGCCycleType.get(trace.getGroup(2)); | ||
forwardReference = new ZGCForwardReference( | ||
getClock(), trace.getLongGroup(1), trace.gcCause(3,0), type, ZGCPhase.FULL); | ||
} | ||
|
||
forwardReference.setMemorySummary( | ||
new ZGCMemorySummary( | ||
trace.toKBytes(4), | ||
|
@@ -884,6 +928,10 @@ public void setMemorySummary(ZGCMemorySummary summary) { | |
this.memorySummary = summary; | ||
} | ||
|
||
public boolean hasMemorySummary() { | ||
return this.memorySummary != null; | ||
} | ||
|
||
public void setMetaspaceSummary(ZGCMetaspaceSummary summary) { | ||
this.metaspaceSummary = summary; | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace is slightly out