OLD | NEW |
| (Empty) |
1 const numIterations = 10; | |
2 const numWarmUpIterations = 5; | |
3 | |
4 function startPerformanceTest(connectionType, benchmarkName, | |
5 dataType, isWorker, async, verifyData){ | |
6 var iframe = document.createElement('iframe'); | |
7 if (connectionType === 'WebSocket') { | |
8 iframe.src = "http://localhost:8001/performance_test_iframe.html"; | |
9 } else if (connectionType === 'XHR') { | |
10 iframe.src = "http://localhost:8001/xhr_performance_test_iframe.html"; | |
11 } else { | |
12 iframe.src = "http://localhost:8001/fetch_performance_test_iframe.html"; | |
13 } | |
14 iframe.onload = function() { | |
15 var child = iframe.contentWindow; | |
16 PerfTestRunner.prepareToMeasureValuesAsync({ | |
17 done: function() { | |
18 child.postMessage({'command': 'stop'}, | |
19 'http://localhost:8001'); | |
20 }, | |
21 unit: 'ms', | |
22 iterationCount: numIterations | |
23 }); | |
24 | |
25 child.postMessage({'command': 'start', | |
26 'connectionType': connectionType, | |
27 'benchmarkName': benchmarkName, | |
28 'dataType': dataType, | |
29 'isWorker': isWorker, | |
30 'async': async, | |
31 'verifyData': verifyData, | |
32 'numIterations': numIterations, | |
33 'numWarmUpIterations': numWarmUpIterations}, | |
34 'http://localhost:8001'); | |
35 }; | |
36 document.body.appendChild(iframe); | |
37 } | |
38 | |
39 onmessage = function(message) { | |
40 if (message.data.command === 'log') { | |
41 PerfTestRunner.log(message.data.value); | |
42 } else if (message.data.command === 'measureValue') { | |
43 PerfTestRunner.measureValueAsync(message.data.value); | |
44 PerfTestRunner.gc(); | |
45 } else if (message.data.command === 'notifyAbort') { | |
46 PerfTestRunner.logFatalError("benchmark aborted"); | |
47 } | |
48 }; | |
OLD | NEW |