10 <script src=
"head.js"></script>
14 var s
= document
.location
.search
.substring(1);
15 var params
= s
.split('&');
16 var iterations
, pages
, totalTime
, fudgeTime
;
17 for (var i
= 0; i
< params
.length
; ++i
) {
18 var f
= params
[i
].split('=');
21 iterations
= (f
[1] - 0);
27 totalTime
= (f
[1] - 0);
30 fudgeTime
= (f
[1] - 0);
34 var pages
= cycle
/ iterations
;
35 document
.write("<table border=1>");
36 document
.write("<tr><td>iterations</td><td>" + iterations
+ "</td></tr>");
37 document
.write("<tr><td>pages</td><td>" + pages
+ "</td></tr>");
38 document
.write("<tr><td>milliseconds</td><td>" + totalTime
+ "</td></tr>");
39 document
.write("<tr><td>mean per set</td><td>" + (totalTime
/ iterations
).toFixed(2) + "</td></tr>");
40 document
.write("<tr><td>mean per page</td><td>" + (totalTime
/ iterations
/ pages
).toFixed(2) + "</td></tr>");
41 document
.write("<tr><td>timer lag</td><td>" + (fudgeTime
).toFixed(2) + "</td></tr>");
42 document
.write("<tr><td>timer lag per page</td><td>" + (fudgeTime
/ iterations
/ pages
).toFixed(2) + "</td></tr>");
43 document
.write("</table>");
45 // returns an object with the following properties:
46 // min : min value of array elements
47 // max : max value of array elements
48 // mean : mean value of array elements
49 // vari : variance computation
50 // stdd : standard deviation, sqrt(vari)
51 // indexOfMax : index of max element (the element that is
52 // removed from the mean computation)
53 function getArrayStats(ary
) {
59 for (var i
= 0; i
< ary
.length
; ++i
) {
62 } else if (ary
[i
] > r
.max
) {
69 // ignore max value when computing mean and stddev
70 r
.mean
= (sum
- r
.max
) / (ary
.length
- 1);
73 for (var i
= 0; i
< ary
.length
; ++i
) {
74 if (i
== r
.indexOfMax
)
76 var d
= r
.mean
- ary
[i
];
77 r
.vari
= r
.vari
+ d
* d
;
80 r
.vari
= r
.vari
/ (ary
.length
- 1);
81 r
.stdd
= Math
.sqrt(r
.vari
);
82 r
.errp
= r
.stdd
/ Math
.sqrt((ary
.length
- 1) / 2) / r
.mean
* 100;
86 function appendTableCol(tr
, text
, linkify
) {
87 var doc
= tr
.ownerDocument
;
88 var td
= doc
.createElement("TD");
91 var anchor
= doc
.createElement("A");
92 if (text
.indexOf('http://localhost:') == 0 ||
93 text
.indexOf('file://') == 0) {
94 // URLs for page cycler HTTP and file tests.
95 anchor
.href
= text
+ "/index.html?skip=true";
97 // For Web Page Replay, URLs are same as recorded pages.
100 anchor
.appendChild(doc
.createTextNode(text
));
101 td
.appendChild(anchor
);
104 td
.appendChild(doc
.createTextNode(text
));
109 function getTimeVals() {
110 var rawData
= __get_timings().split(",");
112 for (var i
= 0; i
< iterations
; ++i
) {
113 for (var j
= 0; j
< pages
; ++j
) {
116 timeVals
[j
].push(parseInt(rawData
[j
+ i
*pages
]));
122 function showReport() {
123 var tbody
= document
.getElementById("tbody");
124 var colsums
= [0,0,0,0,0];
125 var timeVals
= getTimeVals();
126 for (var i
= 0; i
< timeVals
.length
; ++i
) {
127 var tr
= document
.createElement("TR");
129 appendTableCol(tr
, __pages()[i
], true);
131 var r
= getArrayStats(timeVals
[i
]);
132 appendTableCol(tr
, r
.min
.toFixed(2));
133 appendTableCol(tr
, r
.max
.toFixed(2));
134 appendTableCol(tr
, r
.mean
.toFixed(2));
135 appendTableCol(tr
, r
.stdd
.toFixed(2));
136 appendTableCol(tr
, r
.errp
.toFixed(2));
137 //appendTableCol(tr, r.chi2.toFixed(2));
139 for (var j
= 0; j
< timeVals
[i
].length
; ++j
) {
140 var tv
= timeVals
[i
][j
];
141 var td
= appendTableCol(tr
, tv
);
142 if (j
== r
.indexOfMax
)
143 td
.setAttribute("class", "discarded");
146 colsums
[0] = colsums
[0] + r
.min
;
147 colsums
[1] = colsums
[1] + r
.max
;
148 colsums
[2] = colsums
[2] + r
.mean
;
149 colsums
[3] = colsums
[3] + r
.stdd
;
150 colsums
[4] = colsums
[4] + r
.errp
;
152 tbody
.appendChild(tr
);
155 var tr
= document
.createElement("TR");
156 appendTableCol(tr
, "totals:");
157 for (var k
= 0; k
< colsums
.length
; ++k
)
158 appendTableCol(tr
, colsums
[k
].toFixed(2));
159 tbody
.appendChild(tr
);
161 window
.onload
= showReport
;
167 <h2>Complete Statistics
</h2>
177 <th colspan=
"10">Runs
</th>
180 <tbody id=
"tbody"></tbody>