Capture profiles off-main thread
Categories
(Core :: Gecko Profiler, enhancement, P3)
Tracking
()
People
(Reporter: mozbugz, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fxp])
When the user selects to capture a profile, nsProfiler::StartGathering() requests profiles from child processes and synchronously grabs the profile from the current process, which can block the main thread for a relatively long time, causing visible jank.
Instead we should move the capture to another thread.
Technical details:
- This means we'll need to stop or pause the profiler so that no more data is added in the main process.
- If the profiler is running, we could possibly do the work on the SamplerThread (it's already there, and would block the profiler anyway).
- In child processes, I think we also gather profiles from the main thread, we should consider moving it off-MT as well.
Comment 1•6 years ago
|
||
(In reply to Gerald Squelart [:gerald] (he/him) from comment #0)
- In child processes, I think we also gather profiles from the main thread, we should consider moving it off-MT as well.
No, child processes gather on a background thread. The ProfilerChild protocol endpoint is moved to a dedicated "ProfilerChild" thread when the connection is established.
The other big challenge for capturing parent process profiles off the main thread would be to grab the profile.meta information on the main thread first, because StreamMetaJSCustomObject only grabs a limited amount of information when called on a background thread.
Comment 2•6 years ago
|
||
On the JS side, we PauseSampling before we collect profiles:
| Reporter | ||
Comment 3•6 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #1)
(In reply to Gerald Squelart [:gerald] (he/him) from comment #0)
- In child processes, I think we also gather profiles from the main thread, we should consider moving it off-MT as well.
No, child processes gather on a background thread. The ProfilerChild protocol endpoint is moved to a dedicated "ProfilerChild" thread when the connection is established.
Thank you. Easy then 😄
The other big challenge for capturing parent process profiles off the main thread would be to grab the profile.meta information on the main thread first, because
StreamMetaJSCustomObjectonly grabs a limited amount of information when called on a background thread.
Good to know. I think most of the time is spent streaming data from the profile buffer, so it's shouldn't be a problem to quickly gather meta information from the main thread, and add the main profile data on a separate thread.
| Reporter | ||
Updated•4 years ago
|
Updated•3 years ago
|
Updated•2 years ago
|
Description
•