firefox-devtools / firefox-devtools/profiler

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

Open
#3,558 8 comments 1 reaction 0 assignees View on GitHub
memory
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 46m
Merged PRs (30d)
27

Description

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:

![image](https://user-images.githubusercontent.com/105529/133720451-274337d7-1fe4-422b-a012-480b93de756d.png)

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

![image](https://user-images.githubusercontent.com/105529/133720498-d0da6e11-3e6b-4dcc-b793-4a896c9006a2.png)

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](https://github.com/firefox-devtools/profiler/files/7182437/2021-09-17-200119506-obfuscated.firefox.json.gz)

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

```
$ simpleperf/app_profiler.py -p com.google.android.apps.maps -r "-f 4000 -g -e cpu-clock --trace-offcpu --duration 30" --activity com.google.android.maps.MapsActivity --skip_collect_binaries
```

Then converted to firefox profiler format.

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-437)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.