Last Comment Bug 812381 - Make an addon to measure tab switch times
: Make an addon to measure tab switch times
Status: ASSIGNED
:
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]
Mentors:
Depends on:
Blocks:
  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:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description (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 https://mail.google.com/mail/u/0/?shva=1#inbox or https://www.facebook.com/profile.php?id=<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 James Abbatiello 2012-11-21 23:07:19 PST
Rough sketch:
https://builder.addons.mozilla.org/package/162308/
Go to about:tabswitch to view collected data.
Comment 2 :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 irc.mozilla.org/#perf
Comment 3 James Abbatiello 2012-11-28 20:40:49 PST
I updated the extension with the above suggestions.
https://builder.addons.mozilla.org/package/162308/

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 :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 Services.io 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:

<html>
  <head>
  ...
    <link rel="stylesheet" href="chrome://global/skin/aboutSupport.css"
          type="text/css"/>
  </head>
Comment 5 James Abbatiello 2012-12-12 20:29:30 PST
Updated:
Add CSS for about:tabswitch
Add per-tab info to about:tabswitch
Put only last switch time in each tab's title
https://builder.addons.mozilla.org/package/162308/
Comment 6 :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 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.