Closed Bug 1667818 Opened 4 years ago Closed 3 years ago

Capture process priority in the profiler / add markers for priority changes

Categories

(Core :: Gecko Profiler, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: mstange, Assigned: mozbugz)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We should capture process priority in the profiler, so that it's easier to find out why some processes don't get many samples. See bug 1646472.

I think that this should be fairly easy to capture:
I believe the priority is set in ProcessPriorityManager::SetProcessPriority(), we'll need to store that somewhere.

The main difficulty is that it can change, in particular during shutdown, I'm not sure how to store that so the priority is known at every point in the profiling session window, and then how to display it in the front-end. 🤔

Possible back-end solution: When the priority is set, record a marker with the previous and current priorities; also store the current priority and output it somewhere when finally capturing the profile. This should be enough information to reconstruct the priority at any time, even when priority markers have fallen off the buffer.

It is also possible to change the priority of individual threads so we should probably capture that as well, right?

As an aside, I'm currently working on capturing CPU measurements (bug 1329600), so hopefully soon we'll know how much processes&threads have spent on the CPU, and on some system we can know the system idle time as well, and that may help a bit for profiles like those shared in bug 1646472.

Priority: -- → P3

hal::SetProcessPriority() is the actual method call that is used to set the priority. ParticularProcessPriorityManager::mPriority caches the current priority of each process. Also, the priority manager only deals with the main process and PContent processes, so other things like RDD won't be affected.

In the parent process, all sub-process priority changes are recorded, with the stack.
In child processes, the new priority is recorded when notified.

Also record priorities during profiler state changes. This is to ensure that we always have at least one record of the priority at the end of the profile, when old priority changes may have already been discarded.

Depends on D118128

Assignee: nobody → gsquelart
Status: NEW → ASSIGNED
Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9b2ffc8e8505
Record priority change markers - r=canaltinova
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Regressions: 1718064
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: