Closed Bug 1676361 Opened 4 years ago Closed 4 years ago

Clean up GeckoProfiler includes

Categories

(Core :: Gecko Profiler, task, P3)

task

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: sg, Assigned: sg)

References

Details

Attachments

(4 files, 1 obsolete file)

No description provided.
Component: General → Gecko Profiler
Product: Firefox Build System → Core

Oooh, bad timing I'm afraid! I'm currently doing some big work around markers, and after bug 1675409 UniqueProfilerBacktrace won't be used anymore, ProfilerMarkerPayload.cpp will be gone, etc. So a lot of your patches won't apply anymore. And I'd rather not rebase bug 1675409 on top of them.

I appreciate that you're cleaning up these things, to reduce include file hell, that's great!
But please wait after bug 1675409 lands -- I'm planning shortly after the freeze next week. Happy to help after that.
But please ping me if it's urgent.

Severity: -- → N/A
Depends on: 1675409
Priority: -- → P3

Ah, that's true, a bit of bad timing. Retrospectively, it would have been better to ask about doing this first, but I was in a rather fine-grained process of identifying expensive headers and reducing their cost. (That being said, GeckoProfiler.h and its dependencies are included at a lot of places where they do not appear to be needed, including things that could be avoided, and costly to parse due to their heavy use of templates [1].)

I'll be happy to revisit my work on top of the patches from Bug 1675409. I'd like not to wait too long in order not to require rebasing on other changes too much, but next week is totally fine.

[1] While clearly a separate issue, I take the opportunity to share this information here: Besides header parsing time, ClangBuildAnalyzer identifies these as among the templates that are most costly to instantiate:

  4017 ms: mozilla::baseprofiler::AddMarker<mozilla::baseprofiler::markers::Text, std::__cxx11::basic_string<char>> (527 times, avg 7 ms)
  4010 ms: mozilla::baseprofiler::AddMarkerToBuffer<mozilla::baseprofiler::markers::NoPayload> (527 times, avg 7 ms)
  3932 ms: mozilla::baseprofiler::AddMarkerToBuffer<mozilla::baseprofiler::markers::Text, std::__cxx11::basic_string<char>> (527 times, avg 7 ms)
  3906 ms: mozilla::base_profiler_markers_detail::AddMarkerToBuffer<mozilla::baseprofiler::markers::NoPayload> (527 times, avg 7 ms)
  3832 ms: mozilla::base_profiler_markers_detail::AddMarkerToBuffer<mozilla::baseprofiler::markers::Text, std::__cxx11::basic_string<char>> (527 times, avg 7 ms)
  3669 ms: mozilla::base_profiler_markers_detail::AddMarkerWithOptionalStackToBuffer<mozilla::baseprofiler::markers::NoPayload> (527 times, avg 6 ms)
  3570 ms: mozilla::base_profiler_markers_detail::AddMarkerWithOptionalStackToBuffer<mozilla::baseprofiler::markers::Text, std::__cxx11::basic_string<char>> (527 times, avg 6 ms)
  3390 ms: mozilla::base_profiler_markers_detail::MarkerTypeSerialization<mozilla::baseprofiler::markers::Text>::Serialize<std::__cxx11::basic_string<char>> (527 times, avg 6 ms)

Maybe these could be explicitly instantiated instead? Or maybe if this is heavily changed by Bug 1675409 as well, I can share the new data after landing that.

Thank you for your patience.
I'd certainly agree with reducing includes where possible. The marker works helps to separate marker-related functions from other profiler functions, so eventually this should help reduce includes as well...

About the expensive AddMarker templated functions, I'm afraid they will be used even more after bug 1675409, because I'm migrating old marker APIs to these new ones!
Maybe it would be worth re-running your analysis after that bug lands? Are there instructions somewhere so I could try it in advance?
Happy to help reduce their cost after that...

(In reply to Gerald Squelart [:gerald] (he/him) from comment #6)

Thank you for your patience.
I'd certainly agree with reducing includes where possible. The marker works helps to separate marker-related functions from other profiler functions, so eventually this should help reduce includes as well...

Sounds good!

About the expensive AddMarker templated functions, I'm afraid they will be used even more after bug 1675409, because I'm migrating old marker APIs to these new ones!
Maybe it would be worth re-running your analysis after that bug lands?

I will definitely do that :)

Are there instructions somewhere so I could try it in advance?

You can use the script from https://bugzilla.mozilla.org/show_bug.cgi?id=1676346#c6 (with some local adaptations). If you have trouble running that, please contact me on Slack/Matrix :)

Attachment #9186882 - Attachment is obsolete: true

I know you're eager to land this.
You may have noticed that bug 1675409 made it to central 2f08ec7e57c3, I see you've updated your patches, but beware that it was backed out in autoland, so it will disappear from the next central!
(It's a trivial fix, so I'll re-land ASAP...)

Thanks for the heads-up! I noticed the second backup already. I still need to fix Bug 1674080 before I can land this anyway. I already updated the patch to build after Bug 1675409, and removed the one relating to UniqueProfilerBacktrace, but I'll check again if there are new GeckoProfiler.h includes that could be avoided now :)

Attachment #9186869 - Attachment description: Bug 1676361 - Remove unused include for GeckoProfiler.h from generated bindings. r=gerald → Bug 1676361 - Remove unused include for GeckoProfiler.h from generated bindings headers. r=gerald
Pushed by malexandru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bb69d4d37b33
Clean up profiler includes. r=gerald
https://hg.mozilla.org/integration/autoland/rev/7fab6d76a6eb
Remove unused include for GeckoProfiler.h from generated bindings headers. r=gerald
https://hg.mozilla.org/integration/autoland/rev/08d5416655f3
Move ExecutionContext to a separate header file to avoid pulling in GeckoProfiler.h everywhere. r=tcampbell
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9062e17fe15c
Move AutoEntryScript to a separate header file to avoid pulling in GeckoProfiler.h everywhere. r=mccr8
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/06452c4c828c
Move AutoEntryScript to a separate header file to avoid pulling in GeckoProfiler.h everywhere. r=mccr8

Fixed the non-unified-build bustages and relanded.

Flags: needinfo?(sgiesecke)
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c6b72f3c76ba
Move AutoEntryScript to a separate header file to avoid pulling in GeckoProfiler.h everywhere. r=mccr8

Backed out changeset c6b72f3c76ba (Bug 1676361) for causing bustages in nsSocketTransportService2.cpp

Backout link: https://hg.mozilla.org/integration/autoland/rev/f4464f7075d664f704635a39899dd150d06e5eff

Push with failures, failure log.

Flags: needinfo?(sgiesecke)
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7541959e1751
Move AutoEntryScript to a separate header file to avoid pulling in GeckoProfiler.h everywhere. r=mccr8
Flags: needinfo?(sgiesecke)
Depends on: 1757596
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: