chrishantha / jfr-flame-graph

Get Method Sampling from Java Flight Recorder Dump and convert to FlameGraph compatible format.
Apache License 2.0
265 stars 63 forks source link

TLAB events create misleading flame graphs #10

Closed oehme closed 6 years ago

oehme commented 6 years ago

Using -e allocation-tlab seems to count the allocation events instead of counting the amount of memory allocated at that stack frame. This means that the flamegraph will show stacks that allocate often, even if they only allocate a few bytes.

As a user I'd expect the flamegraph to point me to the stacks that actually consumed the most memory.

oehme commented 6 years ago

Nevermind, the recording I looked at must have been bad. I tried with a few others and see actual memory usage being shown as expected.

oehme commented 6 years ago

Okay I know now where the problem is. The converter currently reads the "allocationSize" field, which only contains the size of the object that triggered a new TLAB to be created. That doesn't tell you how much memory this type of object is taking up overall. The converter should use the "tlabSize" field instead.

chrishantha commented 6 years ago

Hi @oehme, I'm really sorry for the delay. I will check on this soon and reply. I'm also happy to accept a PR if you can fix the code. :smile:

oehme commented 6 years ago

You can take a look at my fork, it contains a couple of improvements:

chrishantha commented 6 years ago

I checked your fork and saw all your improvements. (I actually saw your fork before your comment). Would you like to send a PR to my project?