Closed Bug 931373 Opened 11 years ago Closed 6 years ago

Optimize PROFILER_MAIN_THREAD_LABEL

Categories

(Core :: Gecko Profiler, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: BenWa, Assigned: jerry)

Details

Currently PROFILER_MAIN_THREAD_LABEL is implemented as an assert that it really is on the main thread THEN it falls back to the non main thread. We should implement it to properly avoid the TLS lookup and replace PROFILER_LABEL where we can easily confirm that this code is main thread only (most of gecko/layout code).

http://mxr.mozilla.org/mozilla-central/source/tools/profiler/GeckoProfilerImpl.h#233
If we call PROFILER_MAIN_THREAD_LABEL() in non-main-thread with release build, it stills save the data into TLS PseudoStack. Is my thought right?
Should we assert when we call PROFILER_MAIN_THREAD_LABEL() in non-main-thread?
If we avoid the TLS and add this on the wrong thread then we'll be modifying the wrong thread' state and exposing ourself to data races. An assertion should be enough here.
Hi Benwa,

In mozilla_sampler_init(),
http://dxr.mozilla.org/mozilla-central/source/tools/profiler/platform.cpp#440
if we pass tls and non-tls pseudo stack to RegisterCurrentThread(), we also need to modify all series of profiler related function into two version(tls and non-tls version).
For example, we should modify the set_tls_stack_top() function in RegisterCurrentThread() into two version.
Is it true?
PROFILER_MAIN_THREAD_LABEL has been removed.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.