annotate chrome/report.js @ 196:dd0018bc27de

Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
author Benjamin Smedberg <benjamin@smedbergs.us>
date Wed, 21 Jul 2010 15:57:39 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
2 /* ***** BEGIN LICENSE BLOCK *****
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
4 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
5 * The contents of this file are subject to the Mozilla Public License Version
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
6 * 1.1 (the "License"); you may not use this file except in compliance with
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
7 * the License. You may obtain a copy of the License at
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
8 * http://www.mozilla.org/MPL/
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
9 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
10 * Software distributed under the License is distributed on an "AS IS" basis,
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
12 * for the specific language governing rights and limitations under the
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
13 * License.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
14 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
15 * The Original Code is tp.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
16 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
17 * The Initial Developer of the Original Code is
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
18 * Mozilla Corporation.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
19 * Portions created by the Initial Developer are Copyright (C) 2007
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
20 * the Initial Developer. All Rights Reserved.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
21 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
22 * Contributor(s):
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
23 * Darin Fisher <darin@meer.net>
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
24 * Rob Helmer <rhelmer@mozilla.com>
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
25 * Vladimir Vukicevic <vladimir@mozilla.com>
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
26 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
27 * Alternatively, the contents of this file may be used under the terms of
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
30 * in which case the provisions of the GPL or the LGPL are applicable instead
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
31 * of those above. If you wish to allow use of your version of this file only
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
32 * under the terms of either the GPL or the LGPL, and not to allow others to
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
33 * use your version of this file under the terms of the MPL, indicate your
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
34 * decision by deleting the provisions above and replace them with the notice
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
35 * and other provisions required by the GPL or the LGPL. If you do not delete
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
36 * the provisions above, a recipient may use your version of this file under
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
37 * the terms of any one of the MPL, the GPL or the LGPL.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
38 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
39 * ***** END LICENSE BLOCK ***** */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
40
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
41 // Constructor
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
42 function Report(pages) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
43 this.pages = pages;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
44 this.timeVals = new Array(pages.length); // matrix of times
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
45 for (var i = 0; i < this.timeVals.length; ++i) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
46 this.timeVals[i] = new Array();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
47 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
48 this.totalCCTime = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
49 this.showTotalCCTime = false;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
50 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
51
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
52 // given an array of strings, finds the longest common prefix
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
53 function findCommonPrefixLength(strs) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
54 if (strs.length < 2)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
55 return 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
56
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
57 var len = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
58 do {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
59 var newlen = len + 1;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
60 var newprefix = null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
61 var failed = false;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
62 for (var i = 0; i < strs.length; i++) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
63 if (newlen > strs[i].length) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
64 failed = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
65 break;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
66 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
67
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
68 var s = strs[i].substr(0, newlen);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
69 if (newprefix == null) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
70 newprefix = s;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
71 } else if (newprefix != s) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
72 failed = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
73 break;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
74 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
75 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
76
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
77 if (failed)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
78 break;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
79
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
80 len++;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
81 } while (true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
82 return len;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
83 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
84
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
85 function compareNumbers(a, b) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
86 return a - b;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
87 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
88
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
89 // returns an object with the following properties:
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
90 // min : min value of array elements
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
91 // max : max value of array elements
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
92 // mean : mean value of array elements
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
93 // vari : variance computation
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
94 // stdd : standard deviation, sqrt(vari)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
95 // indexOfMax : index of max element (the element that is
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
96 // removed from the mean computation)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
97 function getArrayStats(ary) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
98 var r = {};
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
99 r.min = ary[0];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
100 r.max = ary[0];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
101 r.indexOfMax = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
102 var sum = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
103 for (var i = 0; i < ary.length; ++i) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
104 if (ary[i] < r.min) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
105 r.min = ary[i];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
106 } else if (ary[i] > r.max) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
107 r.max = ary[i];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
108 r.indexOfMax = i;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
109 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
110 sum = sum + ary[i];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
111 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
112
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
113 // median
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
114 if (ary.length > 1) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
115 sorted_ary = ary.concat();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
116 sorted_ary.sort(compareNumbers);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
117 // remove longest run
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
118 sorted_ary.pop();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
119 if (sorted_ary.length%2) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
120 r.median = sorted_ary[(sorted_ary.length-1)/2];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
121 }else{
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
122 var n = Math.floor(sorted_ary.length / 2);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
123 if (n >= sorted_ary.length)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
124 r.median = sorted_ary[n];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
125 else
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
126 r.median = (sorted_ary[n-1] + sorted_ary[n]) / 2;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
127 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
128 }else{
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
129 r.median = ary[0];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
130 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
131
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
132 // ignore max value when computing mean and stddev
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
133 if (ary.length > 1)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
134 r.mean = (sum - r.max) / (ary.length - 1);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
135 else
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
136 r.mean = ary[0];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
137
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
138 r.vari = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
139 for (var i = 0; i < ary.length; ++i) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
140 if (i == r.indexOfMax)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
141 continue;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
142 var d = r.mean - ary[i];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
143 r.vari = r.vari + d * d;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
144 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
145
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
146 if (ary.length > 1) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
147 r.vari = r.vari / (ary.length - 1);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
148 r.stdd = Math.sqrt(r.vari);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
149 } else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
150 r.vari = 0.0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
151 r.stdd = 0.0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
152 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
153 return r;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
154 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
155
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
156 function strPad(o, len, left) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
157 var str = o.toString();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
158 if (!len)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
159 len = 6;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
160 if (left == null)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
161 left = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
162
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
163 if (str.length < len) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
164 len -= str.length;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
165 while (--len) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
166 if (left)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
167 str = " " + str;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
168 else
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
169 str += " ";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
170 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
171 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
172
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
173 str += " ";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
174 return str;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
175 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
176
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
177 function strPadFixed(n, len, left) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
178 return strPad(n.toFixed(0), len, left);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
179 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
180
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
181 Report.prototype.getReport = function(format) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
182 // avg and avg median are cumulative for all the pages
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
183 var avgs = new Array();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
184 var medians = new Array();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
185 for (var i = 0; i < this.timeVals.length; ++i) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
186 avgs[i] = getArrayStats(this.timeVals[i]).mean;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
187 medians[i] = getArrayStats(this.timeVals[i]).median;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
188 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
189 var avg = getArrayStats(avgs).mean;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
190 var avgmed = getArrayStats(medians).mean;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
191
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
192 var report;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
193
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
194 var prefixLen = findCommonPrefixLength(this.pages);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
195
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
196 if (format == "js") {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
197 // output "simple" js format;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
198 // array of { page: "str", value: 123.4, stddev: 23.3 } objects
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
199 report = "([";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
200 for (var i = 0; i < this.timeVals.length; i++) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
201 var stats = getArrayStats(this.timeVals[i]);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
202 report += uneval({ page: this.pages[i].substr(prefixLen), value: stats.mean, stddev: stats.stdd});
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
203 report += ",";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
204 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
205 report += "])";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
206 } else if (format == "jsfull") {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
207 // output "full" js format, with raw values
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
208 } else if (format == "text") {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
209 // output text format suitable for dumping
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
210 report = "============================================================\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
211 report += " " + strPad("Page", 40, false) + strPad("mean") + strPad("stdd") + strPad("min") + strPad("max") + "raw" + "\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
212 for (var i = 0; i < this.timeVals.length; i++) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
213 var stats = getArrayStats(this.timeVals[i]);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
214 report +=
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
215 strPad(i, 4, true) +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
216 strPad(this.pages[i].substr(prefixLen), 40, false) +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
217 strPadFixed(stats.mean) +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
218 strPadFixed(stats.stdd) +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
219 strPadFixed(stats.min) +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
220 strPadFixed(stats.max) +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
221 this.timeVals[i] +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
222 "\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
223 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
224 if (this.showTotalCCTime) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
225 report += "Cycle collection: " + this.totalCCTime + "\n"
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
226 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
227 report += "============================================================\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
228 } else if (format == "tinderbox") {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
229 report = "__start_tp_report\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
230 report += "_x_x_mozilla_page_load,"+avgmed+",NaN,NaN\n"; // max and min are just 0, ignored
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
231 report += "_x_x_mozilla_page_load_details,avgmedian|"+avgmed+"|average|"+avg.toFixed(2)+"|minimum|NaN|maximum|NaN|stddev|NaN\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
232 report += "|i|pagename|median|mean|min|max|runs|\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
233
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
234 for (var i = 0; i < this.timeVals.length; i++) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
235 var r = getArrayStats(this.timeVals[i]);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
236 report += '|'+
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
237 i + ';'+
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
238 this.pages[i].substr(prefixLen) + ';'+
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
239 r.median + ';'+
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
240 r.mean + ';'+
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
241 r.min + ';'+
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
242 r.max + ';'+
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
243 this.timeVals[i].join(";") +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
244 "\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
245 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
246 report += "__end_tp_report\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
247 if (this.showTotalCCTime) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
248 report += "__start_cc_report\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
249 report += "_x_x_mozilla_cycle_collect," + this.totalCCTime + "\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
250 report += "__end_cc_report\n";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
251 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
252 var now = (new Date()).getTime();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
253 report += "__startTimestamp" + now + "__endTimestamp\n"; //timestamp for determning shutdown time, used by talos
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
254 } else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
255 report = "Unknown report format";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
256 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
257
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
258 return report;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
259 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
260
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
261 Report.prototype.recordTime = function(pageIndex, ms) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
262 this.timeVals[pageIndex].push(ms);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
263 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
264
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
265 Report.prototype.recordCCTime = function(ms) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
266 this.totalCCTime += ms;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
267 this.showTotalCCTime = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
268 }