Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <head> | |
| 2 <style> | |
| 3 tr { | |
| 4 white-space: nowrap; | |
| 5 } | |
| 6 .results { | |
| 7 text-align: right; | |
| 8 min-width: 6em; | |
| 9 color: black; | |
| 10 } | |
| 11 </style> | |
| 12 <script> | |
| 13 if (!chrome.benchmarking) { | 1 if (!chrome.benchmarking) { |
|
Mike West
2012/01/27 16:06:32
Copyright.
| |
| 14 alert("Warning: Looks like you forgot to run chrome with " + | 2 alert("Warning: Looks like you forgot to run chrome with " + |
| 15 " --enable-benchmarking set."); | 3 " --enable-benchmarking set."); |
| 16 return; | 4 return; |
| 17 } | 5 } |
| 18 | 6 |
| 19 function setChildTextNode(elementId, text) { | 7 function setChildTextNode(elementId, text) { |
| 20 document.getElementById(elementId).innerText = text; | 8 document.getElementById(elementId).innerText = text; |
| 21 } | 9 } |
| 22 | 10 |
| 23 // Tests the roundtrip time of sendRequest(). | 11 // Tests the roundtrip time of sendRequest(). |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 54 if (response.counter < 1000) { | 42 if (response.counter < 1000) { |
| 55 port.postMessage({counter: response.counter}); | 43 port.postMessage({counter: response.counter}); |
| 56 } else { | 44 } else { |
| 57 timer.stop(); | 45 timer.stop(); |
| 58 var usec = Math.round(timer.microseconds() / response.counter); | 46 var usec = Math.round(timer.microseconds() / response.counter); |
| 59 setChildTextNode("resultsConnect", usec + "usec"); | 47 setChildTextNode("resultsConnect", usec + "usec"); |
| 60 } | 48 } |
| 61 }); | 49 }); |
| 62 }); | 50 }); |
| 63 } | 51 } |
| 64 </script> | 52 |
| 65 </head> | 53 document.addEventListener('DOMContentLoaded', function() { |
| 66 <body> | 54 document.querySelector('#testRequest').addEventListener( |
| 67 <table> | 55 'click', testRequest); |
| 68 <tr> | 56 document.querySelector('#testConnect').addEventListener( |
| 69 <td><button onclick="testRequest()">Measure sendRequest</button></td> | 57 'click', testConnect); |
| 70 <td id="resultsRequest" class="results">(results)</td> | 58 }); |
| 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 |