Closed Bug 1691589 Opened 3 years ago Closed 3 years ago

Move Profiler state-reading and labels APIs to separate headers

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

As part of bug 1691092, we would like to add labels in add-marker functions.
This is currently not possible because label functions are in the main Base/GeckoProfiler.h headers, which include marker headers.
So we need to extract label APIs into a separate header, which can then be included by marker functions.

And this will help with bug 1681416 (splitting profiler headers).

New headers BaseProfilerLabels.h and ProfilerLabels.h now contain all label-related APIs.

These files were hg-copied from the main headers, to preserve history, and then non-label content was removed from the main headers.
The "RAII" macros were moved to these *ProfilerLabels.h headers, because that's the most-common header in which they're needed. Meta-bug 1681416 will probably move these again as needed.

There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".

Depends on D104587

Some label macros use profiler_is_active(), so I'll add a patch to move state-reading APIs to new headers {Base,}ProfilerState.h.
And on the way this will help remove the reliance of {Base,}ProfilerMarkers.h on {Base,Gecko}Profiler.h, which in turn will help reduce the use of GeckoProfiler.h even more.

Summary: Move Profiler labels APIs to separate headers → Move Profiler state-reading and labels APIs to separate headers

New headers BaseProfilerState.h and ProfilerState.h now contain most state-reading APIs.

These files were hg-copied from the main headers, to preserve history, and then chosen declarations were kept only in the relevant header.
This is needed in a following patch, where new headers *ProfilerLabels.h use profiler_is_active().

BaseProfilerMarkers.h can now rely on BaseProfilerState.h (and one function forward declaration), so it doesn't need to include BaseProfiler.h anymore.
Thanks to that, BaseProfiler.h can now include BaseProfilerMarkers.h at the top.

(And equivalent changes in ProfilerMarkers.h and GeckoProfiler.h.)

Depends on D104968

Attachment #9202804 - Attachment description: Bug 1691589 - Don't include BaseProfiler.h in BaseProfilerMarker.h - r?canaltinova → Bug 1691589 - Don't include main profiler headers from markers headers - r?canaltinova
Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/030dc9521157
Extract profiler state APIs into separate headers - r=florian
https://hg.mozilla.org/integration/autoland/rev/fd0f61133b02
Don't include main profiler headers from markers headers - r=florian
https://hg.mozilla.org/integration/autoland/rev/09027f2dc40a
Extract profiler label APIs into separate headers - r=florian
https://hg.mozilla.org/integration/autoland/rev/14358973739c
Reduce reliance on GeckoProfiler.h when only labels (and maybe markers) are needed - r=necko-reviewers,geckoview-reviewers,sg,agi,florian
Regressions: 1693037
You need to log in before you can comment on or make changes to this bug.