-
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
Regarding Java 11 and above, the accuracy issue of ObjectSampler in --total mode #873
Labels
Comments
yanglong1010
changed the title
Regarding Java 11 and above, the accuracy issue of AllocSampler in --total mode
Regarding Java 11 and above, the accuracy issue of ObjectSampler in --total mode
Jan 3, 2024
Thank you for the analysis. Your conclusion makes total sense. Feel free to submit a PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi Andrei
In this code, the number of calls to
testSmallAlloc
andtestLargeAlloc
is different, but their total memory allocations in bytes are close, which can also be proven from the actual running logs.Using
--total
mode, it is expected that the proportions oftestSmallAlloc
andtestLargeAlloc
should be close in the flame graph, but in facttestLargeAlloc
is 99.91% whiletestSmallAlloc
is only 0.81%.The reason is that
size
is used ascounter
inObjectSampler::recordAllocation
, which causes only the array size to be recorded duringtestSmallAlloc
, which is actually theinterval
inJVMTI_EVENT_SAMPLED_OBJECT_ALLOC
(here we ignore the randomness ofinterval
inJVMTI
).async-profiler/src/objectSampler.cpp
Line 163 in 915b090
I feel that
event._total_size
should be used ascounter
here. I verified it on my branch and it looks much normal after the modification.if you think this optimization is feasible, I can create a PR.
The text was updated successfully, but these errors were encountered: