jvm-profiling-tools / honest-profiler

A sampling JVM profiler without the safepoint sample bias
https://github.com/RichardWarburton/honest-profiler/wiki
MIT License
1.25k stars 146 forks source link

Percentages > 100 for recursive methods #186

Open PhRX opened 7 years ago

PhRX commented 7 years ago

In the "flat" or "list" views of methods, it is possible to see percentages exceeding 100%. This happens when a method recursively calls itself directly or indirectly.

Say that in 110 samples, x.y.A is called 100 times from e.g. x.y.Z, and 50 of those times it calls itself again.

That means that x.y.A, when aggregated, will have a total sample count of 150, but the profile only has 110 samples.

Not sure yet how to deal with this. Maybe detect recursion somehow and use max(sample counts) ? Or just highlight methods which call themselves (in)directly ?

nitsanw commented 7 years ago

A solution would be to shrink a trace into a distinct set of methods before applying the increment to counters.