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 numIterations: numIterations + numWarmUpIterations + 1, |
| 31 numWarmUpIterations: numWarmUpIterations, |
| 32 minTotal: 10240000, |
| 33 startSize: 10240000, |
| 34 stopThreshold: 10240000, |
| 35 multipliers: [2], |
| 36 verifyData: verifyData, |
| 37 dataType: dataType, |
| 38 async: async, |
| 39 addToLog: perfTestAddToLog, |
| 40 addToSummary: perfTestAddToSummary, |
| 41 measureValue: perfTestMeasureValue, |
| 42 notifyAbort: perfTestNotifyAbort |
| 43 }; |
| 44 } |
| 45 |
| 46 function startPerformanceTest(connectionType, benchmarkName, |
| 47 dataType, isWorker, async, verifyData){ |
| 48 var config = getConfigForPerformanceTest(connectionType, dataType, async, |
| 49 verifyData); |
| 50 |
| 51 initWorker(connectionType, 'http://localhost:8001'); |
| 52 |
| 53 PerfTestRunner.prepareToMeasureValuesAsync({ |
| 54 done: function() { doAction(config, isWorker, 'stop'); }, |
| 55 unit: 'ms', |
| 56 dromaeoIterationCount: numIterations |
| 57 }); |
| 58 |
| 59 doAction(config, isWorker, benchmarkName); |
| 60 } |
OLD | NEW |