Add profiler markers for shutdown phases in AdvanceShutdownPhaseInternal
Categories
(Core :: XPCOM, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox156 | --- | fixed |
People
(Reporter: jstutte, Assigned: jstutte)
References
Details
Attachments
(2 external files, 1 obsolete file)
AppShutdown::AdvanceShutdownPhaseInternal emits no profiler markers, so shutdown phases are only indirectly visible through the NotifyObservers marker of the topic each phase fires. That leaves two gaps:
XPCOMShutdownFinalandCCPostLastCycleCollectionhave no observer topic (nullptrinsPhaseObserverKeys), so they are entirely invisible in a profile.- The notification is only one part of the phase advance. The two
NS_ProcessPendingEventsdrains,MaybeFastShutdownandKillClearOnShutdownall run outside it, so runnables processed there show up in a profile with no enclosing context.
Add markers for:
AdvanceShutdownPhase- interval over the whole advance, text is the phase nameShutdownDrainBeforePhase- the drain before the phase flipsKillClearOnShutdown- theClearOnShutdownkillShutdownDrainAfterKillClearOnShutdown- the drain after it, with a captured stackShutdownDrainAfterNotification- the drain after the observer notification
Only the post-kill drain captures a stack, since that is where late runnables have caused crashes and where the cost is worth paying.
This is not just bookkeeping: in a local run KillClearOnShutdown accounts for 16.4ms of the 17.2ms XPCOMShutdown phase advance, which is currently invisible in profiles.
| Assignee | ||
Comment 1•2 months ago
|
||
AdvanceShutdownPhaseInternal emits no profiler markers, so shutdown phases are
only indirectly visible through the NotifyObservers marker of the topic each
phase fires. XPCOMShutdownFinal and CCPostLastCycleCollection have no observer
topic at all, and the notification covers only a part of the phase advance: the
two NS_ProcessPendingEvents drains and KillClearOnShutdown run outside it, so
runnables processed there show up with no enclosing context.
Add an interval marker over the whole advance, plus one for each drain and for
KillClearOnShutdown, all carrying the phase name. Only the drain that follows
KillClearOnShutdown captures a stack, since that is where late runnables have
caused crashes.
Updated•2 months ago
|
| Assignee | ||
Comment 2•2 months ago
|
||
The existing "AsyncShutdown blocker" marker spans from the moment a blocker is
registered, which for most blockers is startup, so a profile shows a wall of
multi second intervals that say nothing about shutdown itself.
Stamp the time at which the barrier starts waiting for a blocker and emit a
second marker covering only that wait, so it is visible which blockers actually
delayed which phase.
| Assignee | ||
Comment 3•2 months ago
|
||
KillClearOnShutdown walks a list of type erased observers, so a profile shows
the aggregate cost of a phase's clearing with no way to tell which entry is
responsible, and nothing at all about which entries are registered for a phase.
Record the calling function and line in ShutdownObserver and emit a marker
around each entry. std::source_location would be the natural fit but the build
sysroot still ships libstdc++ 10, so use the same builtins it is implemented
with, as dom/quota/CheckedUnsafePtr.h already does.
Comment 4•2 months ago
|
||
Comment on attachment 9629410 [details]
Bug 2065408 - Add a profiler marker per ClearOnShutdown entry. r?#xpcom-reviewers
Revision D320448 was moved to bug 2065730. Setting attachment 9629410 [details] to obsolete.
| Assignee | ||
Comment 5•2 months ago
|
||
Bug 2055234 comment 16 is a case where the existing AsyncShutdown marker is misleading. I wonder if anybody actually needs this one.
Comment 7•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/419a2e88ba65
https://hg.mozilla.org/mozilla-central/rev/8d923a80f4e5
Description
•