-
Notifications
You must be signed in to change notification settings - Fork 39
[#531] JFR events for allocation and resizing #532
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
base: main
Are you sure you want to change the base?
Conversation
| public long[] readLongs(String fieldName) throws IOException { | ||
| List<Long> values = readCollection(fieldName, new ArrayList<>(), Long.class); | ||
| long[] result = new long[values.size()]; | ||
| JfrEventPublisher.bufferAllocateEvent(result.length * Long.BYTES); |
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 am most likely micro-optimizing, but if JFR is disabled, you're still doing unnecessary multiplications. WOuldn't it be better to have bufferAllocateLong, bufferAllocateInteger, etc methods instead and do the multiplication only inside the if statement?
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.
That sounds good. Let me update.
e803c78 to
ecd0fb8
Compare
|
@jabolina Did you find using this showed anything interesting? I wonder how easy it is to parse this type of information. |
* Requires JFR package. * Covering read and write path.
ecd0fb8 to
66201f9
Compare
|
Ok, I've pushed a small script to generate a summary: |
|
I think it might be useful to put the script somewhere. My only complaint is technically don't we have this with JFR/async profiler when tracking allocations? I am trying to think when I would use this over that. |
|
I see. I think allocation with JFR/async-profiler would be generalized to the whole JVM. You should then be able to filter out when generating the flamegraph. I guess the flamegraph would be larger in places where it has more allocations? I am not sure if it exposes the allocation size (you can set a minimum size in asprof). And it wouldn't distinguish between allocating or resizing a buffer either. All in all, I guess this provides a little more specific info. |

Closes #531.