Hello all,
In Firefox 131 we shipped the ability to control the Firefox profiler
using POSIX signals on MacOS and Linux [0]. Send SIGUSR1 to Firefox's
main process to start the profiler, and SIGUSR2 to stop the profiler and
dump a json profile to disk.
We hope that this feature will be useful for debugging Firefox in
situations where controlling the profiler via "traditional" means (such
as the UI or keyboard shortcuts) is not possible. We are already using
this functionality to attempt to gather a profile if Firefox hangs while
being tested in CI [1], so if you find yourself facing any intermittent
hangs, look to the artefacts panel in treeherder for a useful profile!
Please see profiler front-end documentation for more details of using
the feature [2], and the inline documentation if you are interested in
the implementation [3].
Finally, please reach out if you find any issues, novel uses, or manage
to fix any particularly gnarly bugs using this!
Many thanks,
Adam & The Profiler Team
[0] See Bug 1823370 for the meta-bug tracking this work.
[1]
https://phabricator.services.mozilla.com/D214842
[2]
https://profiler.firefox.com/docs/#/./async-posix-signal-control
[3]
https://searchfox.org/mozilla-central/source/tools/profiler/core/platform.cpp#552