firefox-devtools / firefox-devtools/profiler

CPU tooltip is incorrect in this profile (shouldn't take idle category into account)

Open
#4,750 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 5h
Merged PRs (30d)
30

Description

Profile: https://share.firefox.dev/3rs1iui

In this profile, the parent process shows CPU usage between 0% and 40%, with "hills" and "valleys".

However, looking at the samples' `threadCPUDelta` shows that CPU usage is fairly even across the entire range. So the CPU usage tooltip is incorrect - all the 0%s should be 30-40% instead.

During the valleys, the samples have the "idle" category. We treat them as 0% CPU for the purposes of activity graph drawing, but maybe we shouldn't do so for the purposes of CPU tooltip calculation.

I think what happens here is that the CPU work is happening at a rate that is (almost) an integer multiple of the sampling frequency. We are sending `devicemotion` events at 125.2Hz and the profiler is sampling at 250Hz. So we get "harmonics", and the hill/valley pattern is the [beat](https://en.wikipedia.org/wiki/Beat_(acoustics)) caused by the two frequencies.

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

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.