Fix for Gctoolkit #372 - YoungDetails event not published for GC log collected with -Xlog:gc (no *)#430
Merged
kcpeppe merged 2 commits intomicrosoft:mainfrom Apr 21, 2025
Merged
Conversation
Contributor
|
This looks good, thank you! There is additional work that needs to be done but I'll create a new issue to describe that. As for test data, yes, you will need to add the log files to gctoolkit-testdata. Once that is in, I'll trigger a release. |
kcpeppe
approved these changes
Apr 21, 2025
Contributor
kcpeppe
left a comment
There was a problem hiding this comment.
Needs a follow on issue to fix diarization tests for the Generational, Z, and Shenandoah collectors.
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Approach:
Both files that are generated using -Xlog:gc and -Xlog:gc* use the same general format for the log line of interest:
-Xlog:gc:
[6.837s][info][gc] GC(3) Pause Young (Normal) (G1 Evacuation Pause) 79M->27M(1024M) 2.929ms-Xlog:gc*:
[1.361s][info ][gc ] GC(0) Pause Young (Normal) (G1 Evacuation Pause) 18874M->9037M(81920M) 23.698msThe main difference is that for -Xlog:gc, this is the only line that is printed for an event, whereas -Xlog:gc* prints a CPU time line right afterward, which GCToolkit currently uses as a publish trigger:
[1.361s][info ][gc,cpu ] GC(0) User=0.95s Sys=0.09s Real=0.02sTo address this issue, I've added a Diarizer flag PRINT_CPU_TIMES that is populated when extracting decorators. If this flag is unset/unsure, the UnifiedG1GCParser.youngDetails() method will populate remaining fields (GC Type - Young, GC Cause extracted from trace 4 (offset -2), StartTime as reported by getClock()) and attempt to publish the event. I have left in a null check on GCType in the publish condition as a failsafe, but in theory it could be removed.
I think this should be reasonably solid, is a relatively minor change, and it will keep events being published in order.
Test Updates
Not much done here, other than adding a couple of updates to existing test cases. I can provide a sample file, and can update some additional suites, though I wanted to confirm how I can go about doing that. Is it just a matter of a PR to gctoolkit-testdata with the new file first?