Closed Bug 1716274 Opened 4 years ago Closed 4 years ago

Add way to register callbacks that the profiler will invoke when its state changes

Categories

(Core :: Gecko Profiler, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

Details

Attachments

(1 file)

Reason:
For things like bug 1667818 (where we want to know process priorities at all time), we need to make sure that there is always enough information in a profile to be able to reconstruct a full timeline of some value across time.
One step is to record a marker when the value changes. But this marker could be lost: Maybe the profiler is paused, maybe it's discarded when old data must be removed from the profile buffer.
So the second step is to record markers with the known value when the profiler changes state. E.g., when it pauses, resumes, shuts down, or when a profile is recorded. This way when the profile is output, there should always be at least a final marker with the value.

To achieve this, I'm adding functions to add such callbacks, with a choice of when to invoke them. And optionally a unique identifier may be provided (e.g., the address of an owned object), which can be used to remove the callback later on.

Callbacks can be registered to be called at specific profiler state changes.
This may be useful to make sure some markers are recorded at the end of the profile time range, if some information would be useful to always have available (and it doesn't fit in meta-information or elsewhere).

Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9e1313f55c94 profiler_add/remove_state_change_callback - r=canaltinova
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: