Give each worker type its own thread name
Categories
(Core :: DOM: Workers, enhancement, P3)
Tracking
()
People
(Reporter: asuth, Unassigned)
Details
Right now every worker thread gets named "DOM Worker" and this is what we see in crash stats and the Firefox Profiler and such. This currently comes from https://searchfox.org/mozilla-central/rev/131338e5017bc0283d86fb73844407b9a2155c98/dom/workers/WorkerThread.cpp#92. It would be nice to not have to guess about what type of worker a given thread is.
Since we don't number the workers and the maximum thread length is 16, I think we can go with explicit names:
- "Dedicated Worker" length is 16
- "Shared Worker" length is 13
- "Service Worker" length is 14
- "Chrome Worker" length is 13.
The one complication is that the RuntimeService has a concept of idle threads where it assumes that the threads are all interchangeable.
- ScheduleWorker just uses the first idle thread it finds at https://searchfox.org/mozilla-central/rev/131338e5017bc0283d86fb73844407b9a2155c98/dom/workers/RuntimeService.cpp#1420
- NoteIdleThread determines whether to keep the thread around at https://searchfox.org/mozilla-central/rev/131338e5017bc0283d86fb73844407b9a2155c98/dom/workers/RuntimeService.cpp#2038 with a reaper timer
We have a method NS_SetCurrentThreadName, so we can update the names. It might make sense to also change the name in NoteIdleThread so it's "Idle Worker" with a length of 11.
Impacted Consumers
It seems like we'd also want to either update these locations that currently have a mapping for "DOM Worker" or file follow-up bugs:
- https://searchfox.org/mozilla-central/source/devtools/client/performance-new/components/Settings.js#116
- https://searchfox.org/mozilla-central/rev/131338e5017bc0283d86fb73844407b9a2155c98/tools/profiler/core/platform.cpp#3437
The firefox profiler code proper doesn't seem to have any direct codification of DOM Worker, although it has some test cases that do: https://github.com/firefox-devtools/profiler/search?q=%22DOM+Worker%22&unscoped_q=%22DOM+Worker%22
Updated•2 years ago
|
Description
•