-
Notifications
You must be signed in to change notification settings - Fork 816
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
Support alloc event in pprof converter #844
Conversation
Note there is already another PR #713 for the similar functionality. |
@apangin Hi, thanks for advices. I've resolved comments above. For |
@apangin All resolved, please review again. Thanks! |
profile.field(PROFILE_STRING_TABLE, "allocation_size".getBytes(StandardCharsets.UTF_8)); | ||
final int allocationSizeKeyId = stringId++; | ||
profile.field(PROFILE_STRING_TABLE, "bytes".getBytes(StandardCharsets.UTF_8)); | ||
final int allocationSizeUnitId = stringId++; |
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.
Are these strings only need for allocation profile? Does it make sense to put them under if (eventClass == AllocationSample.class)
?
final Proto sample = new Proto(1_000).field(SAMPLE_VALUE, nanosSinceLastSample); | ||
sample.field(SAMPLE_VALUE, nanosSinceLastSample); | ||
if (eventClass == AllocationSample.class) { | ||
sample.field(SAMPLE_LABEL, allocationLabel.field(LABEL_NUM, jfrSample.value())); |
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.
field
method mutates the object; it's not correct to reuse allocationLabel
this way.
File dst = new File(args[1]); | ||
Class<? extends Event> eventClass = args.alloc ? AllocationSample.class : ExecutionSample.class; | ||
|
||
String output = Optional.ofNullable(args.output).orElse(args.input.replace(".jfr", ".pprof")); |
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.
I'd rewrite this with a regular if
: Optional
makes this harder to follow. Also, args.input.replace
will be called regardless of the value of output
.
Hi, is this PR still relevant? |
Obsoleted by #905 |
Currently, the pprof converter only supports CPU events. This PR adds support for converting alloc events to pprof format.