OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Apple's Speedometer performance benchmark. | 5 """Apple's Speedometer performance benchmark. |
6 | 6 |
7 Speedometer measures simulated user interactions in web applications. | 7 Speedometer measures simulated user interactions in web applications. |
8 | 8 |
9 The current benchmark uses TodoMVC to simulate user actions for adding, | 9 The current benchmark uses TodoMVC to simulate user actions for adding, |
10 completing, and removing to-do items. Speedometer repeats the same actions using | 10 completing, and removing to-do items. Speedometer repeats the same actions using |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 keychain_metric.KeychainMetric.CustomizeBrowserOptions(options) | 49 keychain_metric.KeychainMetric.CustomizeBrowserOptions(options) |
50 | 50 |
51 def ValidateAndMeasurePage(self, page, tab, results): | 51 def ValidateAndMeasurePage(self, page, tab, results): |
52 tab.WaitForDocumentReadyStateToBeComplete() | 52 tab.WaitForDocumentReadyStateToBeComplete() |
53 iterationCount = 10 | 53 iterationCount = 10 |
54 # A single iteration on android takes ~75 seconds, the benchmark times out | 54 # A single iteration on android takes ~75 seconds, the benchmark times out |
55 # when running for 10 iterations. | 55 # when running for 10 iterations. |
56 if tab.browser.platform.GetOSName() == 'android': | 56 if tab.browser.platform.GetOSName() == 'android': |
57 iterationCount = 3 | 57 iterationCount = 3 |
58 | 58 |
59 tab.ExecuteJavaScript2(""" | 59 tab.ExecuteJavaScript(""" |
60 // Store all the results in the benchmarkClient | 60 // Store all the results in the benchmarkClient |
61 benchmarkClient._measuredValues = [] | 61 benchmarkClient._measuredValues = [] |
62 benchmarkClient.didRunSuites = function(measuredValues) { | 62 benchmarkClient.didRunSuites = function(measuredValues) { |
63 benchmarkClient._measuredValues.push(measuredValues); | 63 benchmarkClient._measuredValues.push(measuredValues); |
64 benchmarkClient._timeValues.push(measuredValues.total); | 64 benchmarkClient._timeValues.push(measuredValues.total); |
65 }; | 65 }; |
66 benchmarkClient.iterationCount = {{ count }}; | 66 benchmarkClient.iterationCount = {{ count }}; |
67 startTest(); | 67 startTest(); |
68 """, | 68 """, |
69 count=iterationCount) | 69 count=iterationCount) |
70 tab.WaitForJavaScriptCondition2( | 70 tab.WaitForJavaScriptCondition( |
71 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', | 71 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', |
72 timeout=600) | 72 timeout=600) |
73 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 73 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
74 page, 'Total', 'ms', | 74 page, 'Total', 'ms', |
75 tab.EvaluateJavaScript2('benchmarkClient._timeValues'), | 75 tab.EvaluateJavaScript('benchmarkClient._timeValues'), |
76 important=True)) | 76 important=True)) |
77 | 77 |
78 # Extract the timings for each suite | 78 # Extract the timings for each suite |
79 for suite_name in self.enabled_suites: | 79 for suite_name in self.enabled_suites: |
80 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 80 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
81 page, suite_name, 'ms', | 81 page, suite_name, 'ms', |
82 tab.EvaluateJavaScript2(""" | 82 tab.EvaluateJavaScript(""" |
83 var suite_times = []; | 83 var suite_times = []; |
84 for(var i = 0; i < benchmarkClient.iterationCount; i++) { | 84 for(var i = 0; i < benchmarkClient.iterationCount; i++) { |
85 suite_times.push( | 85 suite_times.push( |
86 benchmarkClient._measuredValues[i].tests[{{ key }}].total); | 86 benchmarkClient._measuredValues[i].tests[{{ key }}].total); |
87 }; | 87 }; |
88 suite_times; | 88 suite_times; |
89 """, | 89 """, |
90 key=suite_name), important=False)) | 90 key=suite_name), important=False)) |
91 keychain_metric.KeychainMetric().AddResults(tab, results) | 91 keychain_metric.KeychainMetric().AddResults(tab, results) |
92 | 92 |
(...skipping 28 matching lines...) Expand all Loading... |
121 | 121 |
122 | 122 |
123 class SpeedometerTurbo(Speedometer): | 123 class SpeedometerTurbo(Speedometer): |
124 def SetExtraBrowserOptions(self, options): | 124 def SetExtraBrowserOptions(self, options): |
125 super(SpeedometerTurbo, self).SetExtraBrowserOptions(options) | 125 super(SpeedometerTurbo, self).SetExtraBrowserOptions(options) |
126 v8_helper.EnableTurbo(options) | 126 v8_helper.EnableTurbo(options) |
127 | 127 |
128 @classmethod | 128 @classmethod |
129 def Name(cls): | 129 def Name(cls): |
130 return 'speedometer-turbo' | 130 return 'speedometer-turbo' |
OLD | NEW |