OLD | NEW |
1 <head> | 1 <head> |
2 <title>Page Benchmark Options</title> | 2 <title>Page Benchmark Options</title> |
3 <script src="jst/util.js" type="text/javascript"></script> | 3 <script src="jst/util.js" type="text/javascript"></script> |
4 <script src="jst/jsevalcontext.js" type="text/javascript"></script> | 4 <script src="jst/jsevalcontext.js" type="text/javascript"></script> |
5 <script src="jst/jstemplate.js" type="text/javascript"></script> | 5 <script src="jst/jstemplate.js" type="text/javascript"></script> |
6 <script src="jst/jstemplate_example.js" type="text/javascript"></script> | 6 <script src="jst/jstemplate_example.js" type="text/javascript"></script> |
7 | 7 |
8 <style> | 8 <style> |
9 body { | 9 body { |
10 font-size: 84%; | 10 font-size: 84%; |
11 font-family: Arial, Helvetica, sans-serif; | 11 font-family: Arial, Helvetica, sans-serif; |
12 padding: 0.75em; | 12 padding: 0.75em; |
13 margin: 0; | 13 margin: 0; |
14 min-width: 45em; | 14 min-width: 45em; |
15 } | 15 } |
16 | 16 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 font-size: 84%; | 57 font-size: 84%; |
58 table-layout: fixed; | 58 table-layout: fixed; |
59 } | 59 } |
60 | 60 |
61 table.list:not([class*='filtered']) tr:nth-child(odd) td:not([class*='filtered']
) { | 61 table.list:not([class*='filtered']) tr:nth-child(odd) td:not([class*='filtered']
) { |
62 background: #eff3ff; | 62 background: #eff3ff; |
63 } | 63 } |
64 | 64 |
65 table.list th { | 65 table.list th { |
66 padding: 0 0.5em; | 66 padding: 0 0.5em; |
67 vertical-align: top; | 67 vertical-align: bottom; |
68 font-weight: bold; | 68 font-weight: bold; |
69 color: #315d94; | 69 color: #315d94; |
70 color: black; | 70 color: black; |
71 white-space: nowrap; | |
72 text-align: center; | 71 text-align: center; |
73 } | 72 } |
74 | 73 |
75 .avg { | 74 .avg { |
76 font-weight: bold; | 75 font-weight: bold; |
77 text-align: center; | 76 text-align: center; |
78 } | 77 } |
79 | 78 |
80 .data { | 79 .data { |
81 text-align: left; | 80 text-align: left; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 variance = variance + deviation * deviation; | 119 variance = variance + deviation * deviation; |
121 } | 120 } |
122 variance = variance / count; | 121 variance = variance / count; |
123 return Math.sqrt(variance).toFixed(2); | 122 return Math.sqrt(variance).toFixed(2); |
124 } | 123 } |
125 | 124 |
126 // Computes min/max/mean/stddev, etc all up front. | 125 // Computes min/max/mean/stddev, etc all up front. |
127 function computeResults(data) { | 126 function computeResults(data) { |
128 for (var i = 0; i < data.data.length; i++) { | 127 for (var i = 0; i < data.data.length; i++) { |
129 var obj = data.data[i]; | 128 var obj = data.data[i]; |
130 obj.mean = Array.avg(data.data[i].results); | 129 var resultList = obj.totalResults; |
131 obj.stddev = Array.stddev(data.data[i].results); | 130 obj.mean = Array.avg(resultList); |
132 obj.min = Array.min(data.data[i].results); | 131 obj.stddev = Array.stddev(resultList); |
133 obj.max = Array.max(data.data[i].results); | 132 obj.min = Array.min(resultList); |
| 133 obj.max = Array.max(resultList); |
| 134 obj.readbps = (obj.bytesRead * 8 / obj.totalTime).toFixed(2); |
| 135 obj.writebps = (obj.bytesWritten * 8 / obj.totalTime).toFixed(2); |
| 136 obj.readKB = (obj.bytesRead / 1024).toFixed(0); |
| 137 obj.writeKB = (obj.bytesWritten / 1024).toFixed(0); |
| 138 obj.paintMean = Array.avg(obj.paintResults); |
| 139 obj.docLoadMean = Array.avg(obj.docLoadResults); |
134 } | 140 } |
135 | 141 |
136 // Find the biggest sample for our bar graph. | 142 // Find the biggest sample for our bar graph. |
137 max_sample = 0; | 143 max_sample = 0; |
138 for (var i = 0; i < data.data.length; i++) { | 144 for (var i = 0; i < data.data.length; i++) { |
139 if (data.data[i].max > max_sample) { | 145 if (data.data[i].max > max_sample) { |
140 max_sample = data.data[i].max; | 146 max_sample = data.data[i].max; |
141 } | 147 } |
142 } | 148 } |
143 } | 149 } |
144 | 150 |
145 function jsinit() { | 151 function jsinit() { |
146 // Run the template to show results | 152 // Run the template to show results |
147 var data = window.opener.results; | 153 var data = window.opener.results; |
148 computeResults(data); | 154 computeResults(data); |
149 | 155 |
150 var context = new JsEvalContext(data); | 156 var context = new JsEvalContext(data); |
151 context.setVariable('$width', 0); | 157 context.setVariable('$width', 0); |
152 context.setVariable('$samples', 0); | 158 context.setVariable('$samples', 0); |
153 var template = document.getElementById("t"); | 159 var template = document.getElementById("t"); |
154 jstProcess(context, template); | 160 jstProcess(context, template); |
155 | 161 |
156 // Set the options | 162 // Set the options |
157 var extension = window.opener; | 163 var extension = window.opener; |
158 document.getElementById("iterations").value = extension.iterations; | 164 document.getElementById("iterations").value = extension.iterations; |
159 document.getElementById("clearconns").checked = extension.clearConnections; | 165 document.getElementById("clearconns").checked = extension.clearConnections; |
160 document.getElementById("clearcache").checked = extension.clearCache; | 166 document.getElementById("clearcache").checked = extension.clearCache; |
| 167 document.getElementById("testurl").value = extension.testUrl; |
161 } | 168 } |
162 | 169 |
163 function getWidth(mean, max_width) { | 170 function getWidth(mean, max_width) { |
164 return Math.floor(max_width * (mean / max_sample)); | 171 return Math.floor(max_width * (mean / max_sample)); |
165 } | 172 } |
166 | 173 |
167 // Apply configuration back to our extension | 174 // Apply configuration back to our extension |
168 function config() { | 175 function config() { |
169 var extension = window.opener; | 176 var extension = window.opener; |
170 var iterations = parseInt(document.getElementById("iterations").value); | 177 var iterations = parseInt(document.getElementById("iterations").value); |
171 var clearConnections = document.getElementById("clearconns").checked; | 178 var clearConnections = document.getElementById("clearconns").checked; |
172 var clearCache = document.getElementById("clearcache").checked; | 179 var clearCache = document.getElementById("clearcache").checked; |
173 if (iterations > 0) { | 180 if (iterations > 0) { |
174 extension.iterations = iterations; | 181 extension.iterations = iterations; |
175 extension.clearConnections = clearConnections; | 182 extension.clearConnections = clearConnections; |
176 extension.clearCache = clearCache; | 183 extension.clearCache = clearCache; |
177 } | 184 } |
178 } | 185 } |
179 | 186 |
| 187 // Set the url in the benchmark url box. |
| 188 function setUrl(url) { |
| 189 document.getElementById("testurl").value = url; |
| 190 } |
| 191 |
| 192 // Start the benchmark. |
| 193 function run() { |
| 194 var extension = window.opener; |
| 195 var testUrl = document.getElementById("testurl").value; |
| 196 extension.testUrl = testUrl; |
| 197 extension.run(); |
| 198 } |
| 199 |
180 // Clear the results | 200 // Clear the results |
181 function clearResults() { | 201 function clearResults() { |
182 window.opener.results.data = new Array(); | 202 window.opener.results.data = new Array(); |
183 jsinit(); | 203 jsinit(); |
184 } | 204 } |
185 </script> | 205 </script> |
186 | 206 |
187 </head> | 207 </head> |
188 | 208 |
189 <body onload="jsinit()"> | 209 <body onload="jsinit()"> |
190 | 210 |
191 <h1><div id="header">Page Benchmark Results</div></h1> | 211 <h1><div id="header">Page Benchmark Results</div></h1> |
192 | 212 |
193 <h1>Configuration</h1> | 213 <h1>Configuration</h1> |
194 | 214 |
195 <span>Iterations</span> | 215 <span>Iterations</span> |
196 <input id="iterations" type=text style="text-align:right"> | 216 <input id="iterations" type=text style="text-align:right"> |
197 <input type="button" value="Clear Results" onclick="clearResults();"> | 217 <input type="button" value="Clear Results" onclick="clearResults();"> |
198 Clear Connections?<input id="clearconns" type="checkbox"> | 218 Clear Connections?<input id="clearconns" type="checkbox"> |
199 Clear Cache?<input id="clearcache" type="checkbox"> | 219 Clear Cache?<input id="clearcache" type="checkbox"> |
200 <input type="button" value="OK" onclick="config();"> | 220 <input type="button" value="OK" onclick="config();"><P> |
| 221 URL to load <input type="text" id="testurl" size=100 value="http://www.google.co
m/"></input> |
| 222 <input type="button" value="Run" onclick="run();"><P> |
201 <p> | 223 <p> |
202 | 224 |
203 <h1>Results</h1> | 225 <h1>Results</h1> |
204 | 226 |
205 <table class="list" width="100%"> | 227 <table class="list" width="100%"> |
206 <tr> | 228 <tr> |
207 <th width=30%>url</th> | 229 <th width=30%>url</th> |
208 <th width=50>avg</th> | 230 <th width=50>doc load mean</th> |
| 231 <th width=50>paint mean</th> |
| 232 <th width=50>total mean</th> |
209 <th width=50>stddev</th> | 233 <th width=50>stddev</th> |
210 <th width=50>min</th> | 234 <th width=50>min</th> |
211 <th width=50>max</th> | 235 <th width=50>max</th> |
| 236 <th width=50>Read KB</th> |
| 237 <th width=50>Write KB</th> |
| 238 <th width=50>Read KBps</th> |
| 239 <th width=50>Write KBps</th> |
212 <th samples</th> | 240 <th samples</th> |
213 </tr> | 241 </tr> |
214 | 242 |
215 <tr id="t" jsselect="data"> | 243 <tr id="t" jsselect="data"> |
216 <td class="url" jseval="$width = getWidth($this.mean, 600)"><div jsvalues=".st
yle.width:$width" class="bggraph"><a jsvalues="href:$this.url" jscontent="url"><
/a></div></td> | 244 <td class="url" jseval="$width = getWidth($this.mean, 600)"><div jsvalues=".st
yle.width:$width" class="bggraph"><a jsvalues="href:$this.url" jscontent="url"><
/a></div></td> |
| 245 <td class="avg" jscontent="docLoadMean"></td> |
| 246 <td class="avg" jscontent="paintMean"></td> |
217 <td class="avg" jscontent="mean"></td> | 247 <td class="avg" jscontent="mean"></td> |
218 <td class="avg" jscontent="stddev"></td> | 248 <td class="avg" jscontent="stddev"></td> |
219 <td class="avg" jscontent="min"></td> | 249 <td class="avg" jscontent="min"></td> |
220 <td class="avg" jscontent="max"></td> | 250 <td class="avg" jscontent="max"></td> |
| 251 <td class="avg" jscontent="readKB"></td> |
| 252 <td class="avg" jscontent="writeKB"></td> |
| 253 <td class="avg" jscontent="readbps"></td> |
| 254 <td class="avg" jscontent="writebps"></td> |
221 <td class="data"><span jsselect="results"><span jscontent="$this"></span>,</sp
an> </td> | 255 <td class="data"><span jsselect="results"><span jscontent="$this"></span>,</sp
an> </td> |
222 </tr> | 256 </tr> |
223 </table> | 257 </table> |
224 | 258 |
225 <script> | 259 <script> |
226 </script> | 260 </script> |
227 | 261 |
228 </body> | 262 </body> |
OLD | NEW |