Closed Bug 1652560 Opened 4 years ago Closed 3 years ago

Allow emitting Gecko profiler labels and stack categories from Rust code (All Rust threads currently marked as non-idle)

Categories

(Core :: Gecko Profiler, task, P3)

task

Tracking

()

RESOLVED FIXED
92 Branch
Tracking Status
firefox92 --- fixed

People

(Reporter: mstange, Assigned: canova)

References

(Blocks 2 open bugs)

Details

Attachments

(11 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

At the moment, Rust threads such as the RenderBackend thread look entirely gray in the activity graph: https://share.firefox.dev/2Ookimx

That's because we currently don't have a way to instrument Rust code with Gecko Profiler labels and categories. We should add a way to do that.

Severity: -- → N/A
Priority: -- → P3

Does https://searchfox.org/mozilla-central/source/servo/components/style/gecko/profiler.rs do most of the work already? We'd need a way to import the list of categories into Rust.

Summary: Allow emitting Gecko profiler labels and stack categories from Rust code → Allow emitting Gecko profiler labels and stack categories from Rust code (All Rust threads currently marked as non-idle)

Bindgen will be needed for gecko_profiler::is_active gecko_profiler_label API
in this patch, as well as the marker API that will land after this.

This is both an API on its own and a prerequisite for profiling label frame
API.

Depends on D120789

Previously ProfilingCategoryList.h was a central place for profiling
categories. But with this patch, profiling_categories.yaml becomes the
canonical place for it and the macro header file is being generated
automatically. This is needed to make the profiling categories in sync with
Rust and C++.

Depends on D120790

Generate the user friendly Rust enums and their impls for profiling categories.

Depends on D120791

This is a syntactic sugar for gecko_profiler_label API. When you use this
macro on top of a function, it will automatically expand the function content
with gecko_profiler_label macro call.

Depends on D120793

This was being used when we had special code for gecko profiler in the servo
codebase but we just removed the last one. This is safe to remove now. The
"enabled" feature in the gecko-profiler crate is being controlled by
gkrust-shared directly now.

Depends on D120795

Assignee: nobody → canaltinova
Status: NEW → ASSIGNED
Attachment #9232970 - Attachment description: WIP: Bug 1652560 - Add bindgen build step to gecko-profiler API crate → Bug 1652560 - Add bindgen build step to gecko-profiler API crate r?emilio!
Attachment #9232971 - Attachment description: WIP: Bug 1652560 - Add gecko_profiler::is_active API for Rust → Bug 1652560 - Add gecko_profiler::is_active API for Rust r?emilio!
Attachment #9232972 - Attachment description: WIP: Bug 1652560 - Autogenerate ProfilingCategoryList.h with profiling_categories.yaml → Bug 1652560 - Autogenerate ProfilingCategoryList.h with profiling_categories.yaml r?emilio!,gerald!
Attachment #9232973 - Attachment description: WIP: Bug 1652560 - Autogenerate profiling_categories.rs with profiling_categories.yaml → Bug 1652560 - Autogenerate profiling_categories.rs with profiling_categories.yaml r?emilio!
Attachment #9232974 - Attachment description: WIP: Bug 1652560 - Add gecko_profiler_label API for adding label frames from Rust code → Bug 1652560 - Add gecko_profiler_label API for adding label frames from Rust code r?emilio!,gerald!
Attachment #9232975 - Attachment description: WIP: Bug 1652560 - Add gecko_profiler_fn_label proc-macro API as an alternative → Bug 1652560 - Add gecko_profiler_fn_label proc-macro API as an alternative r?emilio!
Attachment #9232976 - Attachment description: WIP: Bug 1652560 - Remove the old profiler label frames code in the servo codebase and replace it with the new API → Bug 1652560 - Remove the old profiler label frames code in the servo codebase and replace it with the new API r?emilio!
Attachment #9232977 - Attachment description: WIP: Bug 1652560 - Remove the unused "gecko_profiler" feature from servo → Bug 1652560 - Remove the unused "gecko_profiler" feature from servo r?emilio!
Attachment #9232978 - Attachment description: WIP: Bug 1652560 - Add the gecko-profiler crate to rust clippy lint task → Bug 1652560 - Add the gecko-profiler crate to rust clippy lint task r?emilio!
Pushed by canaltinova@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/c076bfb09873
Add bindgen build step to gecko-profiler API crate r=emilio
https://hg.mozilla.org/integration/autoland/rev/02f1242c8d1c
Add gecko_profiler::is_active API for Rust r=emilio,gerald
https://hg.mozilla.org/integration/autoland/rev/1b2cf2dc3696
Autogenerate ProfilingCategoryList.h with profiling_categories.yaml r=emilio,gerald
https://hg.mozilla.org/integration/autoland/rev/771f07bccfc3
Autogenerate profiling_categories.rs with profiling_categories.yaml r=gerald,emilio
https://hg.mozilla.org/integration/autoland/rev/74250675f2f6
Add gecko_profiler_label API for adding label frames from Rust code r=emilio,gerald
https://hg.mozilla.org/integration/autoland/rev/7f764bd9b66c
Add gecko_profiler_fn_label proc-macro API as an alternative r=emilio
https://hg.mozilla.org/integration/autoland/rev/83d89dc9f835
Remove the old profiler label frames code in the servo codebase and replace it with the new API r=emilio
https://hg.mozilla.org/integration/autoland/rev/99031ce526ea
Remove the unused "gecko_profiler" feature from servo r=emilio
https://hg.mozilla.org/integration/autoland/rev/775e8b8e89d0
Add the gecko-profiler crate to rust clippy lint task r=emilio
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/01a6d80e5357
Remove unused function. r=canaltinova

This makes build specifying

mk_add_options MOZ_MAKE_FLAGS="-j3"

fail!

OOps i meant

mk_add_options MOZ_MAKE_FLAGS="-j1"

Regressions: 1723400
No longer regressions: 1724709
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: