Open Bug 1562082 Opened 6 years ago Updated 2 months ago

Always enable profiler popup icon in local builds

Categories

(DevTools :: Performance Tools (Profiler/Timeline), enhancement, P3)

enhancement

Tracking

(firefox69 affected)

REOPENED
Tracking Status
firefox69 --- affected

People

(Reporter: mozbugz, Unassigned)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [fxp])

Attachments

(1 file, 3 obsolete files)

Most devtools have shortcuts.

I propose we have one for the profiler popup icon, which would be useful when working on local builds that regularly use clean profiles.

The obvious choice would be Ctrl+Shift+1, if not used elsewhere. I guess we'd need to know if the legacy add-on is there, so we don't steal its shortcut.

Bonus points (possibly a separate bug) : Automatically enable the icon if profiler is already started (e.g., for startup profiling).

After discussing with the team:

  • Yet-another shortcut is probably not good, especially as a very small proportion of our users will use the Profiler, and the rest may be confused with the strange icon appearing.
  • A useful compromise would be to just enable the popup icon in local builds, and maybe also in Nightly builds.

In the meantime the icon can be programmatically enabled with the "devtools.performance.popup.feature-flag" pref, which can be set with ./mach run --setpref "devtools.performance.popup.enabled=true"

Summary: Add shortcut to enable profiler popup icon → Always enable profiler popup icon in local builds, and maybe Nightly?

(In reply to Gerald Squelart [:gerald] from comment #1)

...
In the meantime the icon can be programmatically enabled with the "devtools.performance.popup.feature-flag" pref, which can be set with ./mach run --setpref "devtools.performance.popup.enabled=true"

This doesn't seem to work on new profiles (until I manually enable it once). 😪

Ah is it possible that this doesn't work on the prefs that aren't defined in all.js? This pref is defined in code only :/

Maybe Andrew would know about this.

Flags: needinfo?(ahal)

The --setpref option works by writing a user.js file in the profile. So all.js shouldn't affect anything on the tooling side, but maybe it has implications with Firefox that I'm not aware of. On first run (when the pref doesn't work), open the profile and inspect user.js to verify if the pref is in there or not.

Also reading the mach run source, looks like --setpref is only supported if you don't pass in -P/--profile.

Flags: needinfo?(ahal)
Blocks: 1566920
Component: Gecko Profiler → Performance Tools (Profiler/Timeline)
Product: Core → DevTools

(In reply to Gerald Squelart [:gerald] from comment #1)

After discussing with the team:

  • Yet-another shortcut is probably not good, especially as a very small proportion of our users will use the Profiler, and the rest may be confused with the strange icon appearing.
  • A useful compromise would be to just enable the popup icon in local builds, and maybe also in Nightly builds.

We do have some 'local development only' shortcuts (like ctrl+alt+r for doing a restart plus session restore): https://searchfox.org/mozilla-central/source/browser/base/content/browser-development-helpers.js. I think it'd be totally fine to add global shortcut for the profile either directly in browser-development-helpers, or guarded behind !AppConstants.MOZILLA_OFFICIAL in the profile code somewhere, as per https://searchfox.org/mozilla-central/rev/23f836a71cfe961373c8bd0d0219ec60a64b3c8f/browser/base/content/browser.xhtml#95-97.

A useful compromise would be to just enable the popup icon in local builds, and maybe also in Nightly builds.

I like that solution as well. Nightly might also be fine, which is our prime performance contributor base (at least testing it out and gathering feedback).

We touched on this a few times during planning and I didn't hear concerns. Lets enable this for local builds first and then see if devs would also like it for Nightly.

Summary: Always enable profiler popup icon in local builds, and maybe Nightly? → Always enable profiler popup icon in local builds

Related, bug 1385452 landed the restart button for local builds.

This patch will turn on the profiler button for all local builds.

Depends on D66407

Assignee: nobody → gtatum
Status: NEW → ASSIGNED

I mentioned this work to mattn. He pointed out that adding icons for builds has to be done carefully to avoid changing the toolbar for when tests run. He recommended to tie it into mach run.

Yeah, we've had test failures in the past due to toolbar overflow and UITour availableTargets. The toolbar item could also skew local Talos results.

browser-development-helpers.js is what I was thinking of but that also seems to use AppConstants.MOZILLA_OFFICIAL. It looks like the proposed patch also aligns with how we handle debugging prefs. Maybe we don't actually do any additional changes for mach run anymore? bgrins would know.

I guess as long as tests pass in automation and people don't complain too much about local test failures due to different screen resolutions causing toolbar overflow then you're probably fine.

Yeah, I may hook into mach run. I'm holding off on landing this patch for now.

Here's where that would happen:
https://searchfox.org/mozilla-central/rev/f36cb2af46edd2659f446b7acdb2154e230ee445/python/mozbuild/mozbuild/mach_commands.py#1002-1146

Attachment #9132628 - Attachment is obsolete: true
Assignee: gtatum → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
Assignee: nobody → felash
Status: NEW → ASSIGNED

I ended up doing something very similar to Greg's previous patch, but in a simpler way. This doesn't use preferences so it doesn't persist if the user removes the popup button, but I believe it's fine.

I pushed a try with "try auto" because I didn't have a good idea of which tests could be affected by adding this button: https://treeherder.allizom.org/jobs?repo=try&revision=6c24571edfbda0f65401e2716baa8e319612373c

Also I'm a bit afraid we might see a performance regression because of this patch, that would be a red herring because that wouldn't happen in official builds. I wonder if we could avoid that.

Pushed by jwajsberg@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7eb738540ace Always enable the profiler popup icon in local builds r=canaltinova,profiler-reviewers

Backed out for causing bc failures and c2 failures.

Bc failures @browser_914138_widget_API_overflowable_toolbar.js

Bc failures @browser_ext_commands_onCommand.js

C2 failures @test_keycodes.xhtml.

Flags: needinfo?(felash)

<redacted>

Depends on: 1950884
Flags: needinfo?(felash)
Flags: needinfo?(felash)
Flags: needinfo?(felash)
See Also: → 1951906

(In reply to agoloman from comment #17)

Backed out for causing bc failures and c2 failures.

Bc failures @browser_914138_widget_API_overflowable_toolbar.js

Bc failures @browser_ext_commands_onCommand.js

C2 failures @test_keycodes.xhtml.

It's possible these failures happen because asan doesn't have MOZILLA_OFFICIAL, see bug 1951906.

But I changed the patch to always opt out when in automation now.

Whiteboard: [fxp]
Blocks: 1952214
Pushed by jwajsberg@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3b3ed888a219 Always enable the profiler popup icon in local builds r=canaltinova,profiler-reviewers

Comment on attachment 9469925 [details]
Bug 1562082 - Fix possible race when the profiler icon is added in a local build or startup profiling is on r=canaltinova

Revision D240449 was moved to bug 1952214. Setting attachment 9469925 [details] to obsolete.

Attachment #9469925 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch

Backed out for causing marionette failures @ test_assert_no_toolbar_changes.py

TEST-UNEXPECTED-FAIL | browser/components/customizableui/test/marionette/test_assert_no_toolbar_changes.py TestNoToolbarChanges.test_no_toolbar_changes | AssertionError: Lists differ: ['bac[194 chars]oolbar-button', 'profiler-button', 'unified-extensions-button'] != ['bac[194 chars]oolbar-button', 'unified-extensions-button']
Status: RESOLVED → REOPENED
Flags: needinfo?(felash)
Resolution: FIXED → ---
Target Milestone: 138 Branch → ---

I don't have time to deal with it at the moment, removing the needinfo.

Flags: needinfo?(felash)
Attachment #9469926 - Attachment is obsolete: true
Assignee: felash → nobody
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: