Chromium Code Reviews| Index: PerformanceTests/Pywebsocket/resources/util_performance_test.js |
| diff --git a/PerformanceTests/Pywebsocket/resources/util_performance_test.js b/PerformanceTests/Pywebsocket/resources/util_performance_test.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..605ed7180f9d44eb40477a7a56ffc8f17f88c5e1 |
| --- /dev/null |
| +++ b/PerformanceTests/Pywebsocket/resources/util_performance_test.js |
| @@ -0,0 +1,60 @@ |
| +function perfTestAddToLog(text) { |
| + PerfTestRunner.log(text); |
| +} |
| + |
| +function perfTestAddToSummary(text) { |
| +} |
| + |
| +function perfTestMeasureValue(value) { |
| + PerfTestRunner.measureValueAsync(value); |
| + PerfTestRunner.gc(); |
| +} |
| + |
| +function perfTestNotifyAbort() { |
| + PerfTestRunner.logFatalError("benchmark aborted"); |
| +} |
| + |
| +const numIterations = 10; |
| +const numWarmUpIterations = 5; |
| + |
| +function getConfigForPerformanceTest(connectionType, dataType, async, |
| + verifyData) { |
| + return { |
| + prefixUrl: |
| + connectionType === 'WebSocket' ? 'ws://localhost:8001/benchmark_helper' : |
| + 'http://localhost:8001/073be001e10950692ccbf3a2ad21c245', // XHR or fetch |
| + printSize: true, |
| + numXHRs: 1, |
| + numFetches: 1, |
| + numSockets: 1, |
| + numIterations: numIterations + numWarmUpIterations + 1, |
| + numWarmUpIterations: numWarmUpIterations, |
| + minTotal: 10240000, |
| + startSize: 10240000, |
| + stopThreshold: 10240000, |
| + multipliers: [2], |
| + verifyData: verifyData, |
| + dataType: dataType, |
| + async: async, |
| + addToLog: perfTestAddToLog, |
| + addToSummary: perfTestAddToSummary, |
| + measureValue: perfTestMeasureValue, |
| + notifyAbort: perfTestNotifyAbort |
| + }; |
| +} |
| + |
| +function startPerformanceTest(connectionType, benchmarkName, |
| + dataType, isWorker, async, verifyData){ |
| + var config = getConfigForPerformanceTest(connectionType, dataType, async, |
| + verifyData); |
| + |
| + initWorker(connectionType, 'http://localhost:8001'); |
| + |
| + PerfTestRunner.prepareToMeasureValuesAsync({ |
| + done: function() { doAction(config, isWorker, 'stop'); }, |
|
yhirano
2015/08/20 06:17:49
This may be not a problem of this CL, but doAction
hiroshige
2015/09/07 07:29:55
Done, created separate |config| for each doAction(
|
| + unit: 'ms', |
| + dromaeoIterationCount: numIterations |
| + }); |
| + |
| + doAction(config, isWorker, benchmarkName); |
| +} |