Consider hooking pthread_create (or another technique) so that we can profile threads launched by libraries
Categories
(Core :: Gecko Profiler, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox54 | --- | affected |
People
(Reporter: mstange, Unassigned)
References
(Depends on 1 open bug, Blocks 2 open bugs)
Details
Reporter | ||
Comment 1•7 years ago
|
||
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
For what it's worth:
- unnamed threads are now visible in about:processes;
- we can easily test that all threads are OS-level named in the unit tests for about:processes.
Unfortunately, as of today, there are still a few unnamed threads. I'm tracking them as blockers of bug 1630898.
Thank you David.
Obviously about:processes must have a way to get the list of threads (ids and names), I hope the profiler could use the same technique or even the same code, in which case it should be possible to record them.
I think this bug here should depend on bug 1630898 instead of blocking it (i.e., the profiler depends on threads being named before it can profile them) -- But please let me know if you disagree.
Oh, while it's great if we can get a list of threads, I'm guessing it may not be cheap to do that, so the profiler may not be able to do it at every sample point!
If my assumption is sadly correct we will still want to try and catch thread creations (by hooking pthread_create
or other means).
But in the meantime, it could still be valuable to have an option to regularly (1 Hz?) look at the list of threads, and profile new ones at they appear.
And on the flip side, we'll want to catch thread terminations; but that should (hopefully) be trivial as they'll just not be there anymore when we try to sample them. (Another assumption: Thread ids won't be reused in-between two samplings.)
Updated•4 years ago
|
Comment 7•4 years ago
|
||
Yoric (or whomever): where are threads in about:processes? Also, we're talking raw threads/pthreads, not nsThreads which we can already enumerate.
Comment 8•4 years ago
|
||
(In reply to Randell Jesup [:jesup] (needinfo me) from comment #7)
Yoric (or whomever): where are threads in about:processes?
They are shown if you set toolkit.aboutProcesses.showThreads
to true in about:config.
They are hidden by default. You need pref toolkit.aboutProcesses.showThreads
= true
to show them.
Updated•3 years ago
|
I've just filed bug 1742522, which will discover unregistered threads the same way about:processes does.
It should help with profiling library-controlled threads, but not as soon as threads are started, so I will keep this bug here open in case we can actually hook pthread_create
(or equivalent/better, and equivalent on other platforms).
Note that the thread discovery in about:processes is pretty slow.
(In reply to David Teller [:Yoric] - still alive but not very active from comment #11)
Note that the thread discovery in about:processes is pretty slow.
True, it's not be perfect but hopefully it will give some useful data on all platforms, until someone can get this bug here done!
Description
•