Last Comment Bug 812381 - Make an addon to measure tab switch times
: Make an addon to measure tab switch times
Product: Toolkit
Classification: Components
Component: Telemetry (show other bugs)
: unspecified
: x86_64 Windows 7
-- normal with 3 votes (vote)
: ---
Assigned To: James Abbatiello
: Georg Fritzsche [:gfritzsche]
Depends on:
  Show dependency treegraph
Reported: 2012-11-15 16:51 PST by (dormant account)
Modified: 2013-06-27 18:30 PDT (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image (dormant account) 2012-11-15 16:51:57 PST
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
Comment 1 User image James Abbatiello 2012-11-21 23:07:19 PST
Rough sketch:
Go to about:tabswitch to view collected data.
Comment 2 User image :Irving Reid (No longer working on Firefox) 2012-11-28 07:14:39 PST
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
Comment 3 User image James Abbatiello 2012-11-28 20:40:49 PST
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.
Comment 4 User image :Irving Reid (No longer working on Firefox) 2012-12-12 11:53:02 PST
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 User image James Abbatiello 2012-12-12 20:29:30 PST
Add CSS for about:tabswitch
Add per-tab info to about:tabswitch
Put only last switch time in each tab's title
Comment 6 User image :Irving Reid (No longer working on Firefox) 2012-12-13 12:44:29 PST
This looks great, we're going to start using it in the performance team to see if we can pick out particularly slow tabs.
Comment 7 User image Lawrence Mandel [:lmandel] (use needinfo) 2013-01-24 08:10:48 PST
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?

Note You need to log in before you can comment on or make changes to this bug.