Closed Bug 1757596 Opened 4 years ago Closed 4 years ago

Move declarations related to profiler threads sleeping / waking out of GeckoProfiler.h

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: florian, Assigned: mozbugz)

References

Details

Attachments

(3 external files)

Currently GeckoProfiler.h is included by CondVar.h https://searchfox.org/mozilla-central/rev/8f42809e51cb07aa4f5739932a06d14581e9dd4a/xpcom/threads/CondVar.h#16 only in non-debug builds.

This causes includes of many profiler header files in lots of places where they are not really needed, and this causes confusing build errors when building debug builds. Eg. it took me a bit of time to figure out why I had build errors from clang-tidy in https://phabricator.services.mozilla.com/D139733 that I didn't have locally even when moving that cpp file to the non-unified SOURCES list in moz.build.

Seeing that this came from https://phabricator.services.mozilla.com/D96539 makes me think we should also change ReentrantMonitor.h to avoid this confusing non-debug include.

I almost did it in recent bug 1668867 (because of CondVar.h as well), but went another way.

Yes, we could definitely move sleep/wake functions to a new stand-alone header.

Priority: -- → P2

The next patch would have added yet another PROFILERxx_RAII macro, so it makes sense to gather them all into a single header file, to be #included where needed.

Assignee: nobody → gsquelart
Status: NEW → ASSIGNED

Profiler sleep/wake functions/macros/classes are used in a small number of files.
By placing most of them in mozilla/ProfilerThread{Sleep,State}.h, the dependence on GeckoProfiler.h is greatly reduced.
The remaining AUTO_PROFILER_THREAD_WAKE and AutoProfilerThreadWake depend on profiler_is_sleeping() in mozilla/ProfilerThreadState.h (but are rarely used), so it makes sense to move them there instead.

Depends on D140169

And in one case, #include "mozilla/ProfilerThreadState.h" where only AUTO_PROFILER_THREAD_WAKE is used.

Depends on D140172

Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d0ae073e3e04 De-duplicate PROFILER_RAII macros - r=florian https://hg.mozilla.org/integration/autoland/rev/7bf6cba00c11 Move profiler sleep/wake APIs to mozilla/ProfilerThread{Sleep,State}.h - r=florian https://hg.mozilla.org/integration/autoland/rev/09dc0429a37d #include "mozilla/ProfilerThreadSleep.h" instead of GeckoProfiler.h where possible - r=florian
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: