Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flame Graph segment width seems to be weighted by sample count rather than time

See original GitHub issue

This comes up particularly with off-cpu profiling, where one stack sample (when a thread blocks on IO or mutex) might represent a large wall-clock duration.

Compare this screenshot, where a segment has 237 samples and takes 49ms:


With this screenshot, where a segment has 75 samples and takes 9600ms:


I’d expect the 9600ms section to be about 9600/49=195 times larger, but instead the 49ms span is wider.

Here’s an offcpu profile to reproduce with: 2021-09-17-200119506-obfuscated.firefox.json.gz

This was generated using Android simpleperf using off-cpu tracing @4000Hz for 30s:

$ simpleperf/ -p -r "-f 4000 -g -e cpu-clock --trace-offcpu --duration 30" --activity --skip_collect_binaries

Then converted to firefox profiler format.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

julienwcommented, Nov 16, 2022

Yes, we’re still interested! Thanks a lot for looking at this 😃

ryoquncommented, Nov 14, 2022

fyi, i created a very rough pr to fix this. at least, it should be working #4320

is anyone still interested? if so, i may prioritize finishing up the pr.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CPU Flame Graphs - Brendan Gregg
The width of the box shows the total time it was on-CPU or part of an ancestry that was on-CPU (based on sample...
Read more >
Summarizing Xperf CPU Usage with Flame Graphs
Xperf includes a sampling profiler and a very capable viewer of the ... Any type of weighted call stack can be converted to...
Read more >
Does imprecise sample frequency affect correctness of flame ...
According to the source code, the flamegraph generation is totally relying on the sample counts of the stack traces. However, as experiments ...
Read more >
Graphs | Microsoft Learn
Flame graphs ​​ The width of each flame group is determined by its weight value in the view. For example, with CPU stacks,...
Read more >
What is a Flame Graph? How it Works & Use Cases - Datadog
How to Interpret a Flame Graph (with Example). Application monitoring tools use flame graphs to visualize a request's execution path and unify its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found