OLD | NEW |
1 <head> | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 <style> | 2 // Use of this source code is governed by a BSD-style license that can be |
3 tr { | 3 // found in the LICENSE file. |
4 white-space: nowrap; | 4 |
5 } | |
6 .results { | |
7 text-align: right; | |
8 min-width: 6em; | |
9 color: black; | |
10 } | |
11 </style> | |
12 <script> | |
13 if (!chrome.benchmarking) { | 5 if (!chrome.benchmarking) { |
14 alert("Warning: Looks like you forgot to run chrome with " + | 6 alert("Warning: Looks like you forgot to run chrome with " + |
15 " --enable-benchmarking set."); | 7 " --enable-benchmarking set."); |
16 return; | 8 return; |
17 } | 9 } |
18 | 10 |
19 function setChildTextNode(elementId, text) { | 11 function setChildTextNode(elementId, text) { |
20 document.getElementById(elementId).innerText = text; | 12 document.getElementById(elementId).innerText = text; |
21 } | 13 } |
22 | 14 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (response.counter < 1000) { | 46 if (response.counter < 1000) { |
55 port.postMessage({counter: response.counter}); | 47 port.postMessage({counter: response.counter}); |
56 } else { | 48 } else { |
57 timer.stop(); | 49 timer.stop(); |
58 var usec = Math.round(timer.microseconds() / response.counter); | 50 var usec = Math.round(timer.microseconds() / response.counter); |
59 setChildTextNode("resultsConnect", usec + "usec"); | 51 setChildTextNode("resultsConnect", usec + "usec"); |
60 } | 52 } |
61 }); | 53 }); |
62 }); | 54 }); |
63 } | 55 } |
64 </script> | 56 |
65 </head> | 57 document.addEventListener('DOMContentLoaded', function() { |
66 <body> | 58 document.querySelector('#testRequest').addEventListener( |
67 <table> | 59 'click', testRequest); |
68 <tr> | 60 document.querySelector('#testConnect').addEventListener( |
69 <td><button onclick="testRequest()">Measure sendRequest</button></td> | 61 'click', testConnect); |
70 <td id="resultsRequest" class="results">(results)</td> | 62 }); |
71 </tr> | |
72 <tr> | |
73 <td><button onclick="testConnect()">Measure postMessage</button></td> | |
74 <td id="resultsConnect" class="results">(results)</td> | |
75 </tr> | |
76 </table> | |
77 </body> | |
OLD | NEW |