Closed Bug 1742522 Opened 2 years ago Closed 2 years ago

Optionally discover unregistered threads, and profile them if possible

Categories

(Core :: Gecko Profiler, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

(Blocks 4 open bugs)

Details

Attachments

(4 files)

Some threads are not registered, either because the author forgot to add AUTO_PROFILER_REGISTER_THREAD (or it may be difficult in some cases), or they're third-party threads (e.g., launched by libraries we don't control).

This bug will attempt to find these unregistered threads, using the same techniques as in about:processes (i.e., using GetProcInfo directly or indirectly).

This bug and/or follow-ups will also capture as much information as possible, including profiling data like CPU utilization and stacks.

The work happening in bug 1742472 will help reduce the amount of (duplicated) code that's needed for this bug here, so I'll wait for it to land first.
Thanks Florian! 😄

Depends on: 1742472

The profiler uses GetProcInfo to discover unregistered threads.
On Windows, because this work takes much longer than the usual sampling interval, it is done on its own thread.

Depends on D132212

Attachment #9252587 - Attachment description: Bug 1742522 - New profiler feature to spy unregistered threads - r?florian → Bug 1742522 - New profiler feature to discover unregistered threads and capture some data - r?florian

When constructing the SamplerThread object, individual features were extracted from the feature set (a uint32_t), and passed as bools. This could be error-prone, wasteful, and a maintenance burden when more features are needed in some/all platform implementations (like the next patch adding a new feature with a Windows-specific impact).
So now the full feature set is given to the SamplerThread, which can then extract the features it requires on each platform.

Depends on D132317

I've looked at trying to collect stacks from unregistered threads, but the way the profiler's stack-collecting code is currently working is geared towards self-registered threads with special platform-specific data, so I'll leave that more complex feature to a future bug...

Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7ae841376a63
Synchronous version of GetProcInfo - r=florian
https://hg.mozilla.org/integration/autoland/rev/6ad3ac6d47fd
New ProcInfo_common.cpp contains the now-common function GetProcInfo - r=florian
https://hg.mozilla.org/integration/autoland/rev/8dd880bb625b
Pass full feature set to SamplerThread instead of individual features bools - r=florian
https://hg.mozilla.org/integration/autoland/rev/33a5f03babea
New profiler feature to discover unregistered threads and capture some data - r=florian
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: