OLD | NEW |
(Empty) | |
| 1 function perfTestAddToLog(text) { |
| 2 PerfTestRunner.log(text); |
| 3 } |
| 4 |
| 5 function perfTestAddToSummary(text) { |
| 6 } |
| 7 |
| 8 function perfTestMeasureValue(value) { |
| 9 PerfTestRunner.measureValueAsync(value); |
| 10 PerfTestRunner.gc(); |
| 11 } |
| 12 |
| 13 function perfTestNotifyAbort() { |
| 14 PerfTestRunner.logFatalError("benchmark aborted"); |
| 15 } |
| 16 |
| 17 const numIterations = 10; |
| 18 const numWarmUpIterations = 5; |
| 19 |
| 20 function getConfigForPerformanceTest(connectionType, dataType, async, |
| 21 verifyData) { |
| 22 return { |
| 23 prefixUrl: |
| 24 connectionType === 'WebSocket' ? 'ws://localhost:8001/benchmark_helper' : |
| 25 'http://localhost:8001/073be001e10950692ccbf3a2ad21c245', // XHR or fetch |
| 26 printSize: true, |
| 27 numXHRs: 1, |
| 28 numFetches: 1, |
| 29 numSockets: 1, |
| 30 // + 1 is for a warmup iteration by the Telemetry framework. |
| 31 numIterations: numIterations + numWarmUpIterations + 1, |
| 32 numWarmUpIterations: numWarmUpIterations, |
| 33 minTotal: 10240000, |
| 34 startSize: 10240000, |
| 35 stopThreshold: 10240000, |
| 36 multipliers: [2], |
| 37 verifyData: verifyData, |
| 38 dataType: dataType, |
| 39 async: async, |
| 40 addToLog: perfTestAddToLog, |
| 41 addToSummary: perfTestAddToSummary, |
| 42 measureValue: perfTestMeasureValue, |
| 43 notifyAbort: perfTestNotifyAbort |
| 44 }; |
| 45 } |
| 46 |
| 47 function startPerformanceTest(connectionType, benchmarkName, |
| 48 dataType, isWorker, async, verifyData){ |
| 49 initWorker(connectionType, 'http://localhost:8001'); |
| 50 |
| 51 PerfTestRunner.prepareToMeasureValuesAsync({ |
| 52 done: function() { |
| 53 var config = getConfigForPerformanceTest(connectionType, dataType, |
| 54 async, verifyData); |
| 55 doAction(config, isWorker, 'stop'); |
| 56 }, |
| 57 unit: 'ms', |
| 58 dromaeoIterationCount: numIterations |
| 59 }); |
| 60 |
| 61 var config = getConfigForPerformanceTest(connectionType, dataType, async, |
| 62 verifyData); |
| 63 doAction(config, isWorker, benchmarkName); |
| 64 } |
OLD | NEW |