Make an addon to measure tab switch times




5 years ago
4 months ago


(Reporter: (dormant account), Assigned: James Abbatiello)


Firefox Tracking Flags

(Not tracked)




5 years ago
The addon should listen to tab switches, and look at the FX_TAB_SWITCH_TOTAL_MS.sum delta to determine the amount of time the last tabswitch took.

It should also check the url to see if the user is switching to or<profileid>&sk=photos and report times to switch to those websites.

This addon will be used by developers and qa to track firefox performance in a more precise manner than is allowed by telemetry


5 years ago
Assignee: nobody → irving

Comment 1

5 years ago
Rough sketch:
Go to about:tabswitch to view collected data.
Thanks, this is a great start. If you want to take this bug and polish up the extension for us, I'd be happy to provide any help you need. Otherwise, I'll dig into it later this week.

In your code, the tab_switches[] vector is going to grow without bound. You're not adding a lot of data each time, but it would still be better to limit the size. Having a hard coded limit of a few hundred saved data points would probably be plenty.

Taras and I had a couple of conversations about the UI for this; the ideas we were kicking around involved adding the time to the tab title or making it a mouse-over popup on the tab.

If you want to chat about this on line, ping irving on
Flags: needinfo?(abbeyj+bugzilla)

Comment 3

5 years ago
I updated the extension with the above suggestions.

I'm just overwriting the current tab title which may not be very friendly.  The tooltip has linebreaks and so may be easier to read.
Flags: needinfo?(abbeyj+bugzilla)
I think the min/max/average and the list of saved switch times would be better to keep on the about:tabswitch page, rather than in the tab title. Just prepending the most recent switch time onto the existing tab title would be my preference.

The main purpose of this is to make it easier for developers and testers to recognize particular tabs that have very long switch times, and provide a way to feed that information back.

A couple of ideas we've kicked around are:

 - Have a configurable threshold for what a "long" switch is, and only record those (but probably also keep track of total number of switches for reference)

 - have the tab change visually after a "long" switch, aside from the title - change colour or something. This might be hard to make fit well with non-default themes, if we care about them.

I'm not sure I like them; my current thought is to go ahead with something closer to what you already have.

Aside from that, some notes on the add-on code:

in function updatedTabMessage() at around line 51, you can build the string from array without a loop, using tab_switches_for_this_tab.join(",\n").

In AboutComponent.newChannel() you can use at line 85 and Services.scriptSecurityManager at line 88

It would be nice to have some CSS styling on the about page. The simplest way is just to steal an existing css from the browser theme; something like:

    <link rel="stylesheet" href="chrome://global/skin/aboutSupport.css"

Comment 5

5 years ago
Add CSS for about:tabswitch
Add per-tab info to about:tabswitch
Put only last switch time in each tab's title
This looks great, we're going to start using it in the performance team to see if we can pick out particularly slow tabs.
Assignee: irving → abbeyj+bugzilla
Given that James has created an add-on that is now in use, can this bug be resolved? 

Will the add-on be published on AMO?
Last Resolved: 4 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.