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 19 matching lines...) Expand all Loading... |
30 'EmberJS-TodoMVC', | 30 'EmberJS-TodoMVC', |
31 'BackboneJS-TodoMVC', | 31 'BackboneJS-TodoMVC', |
32 'jQuery-TodoMVC', | 32 'jQuery-TodoMVC', |
33 'AngularJS-TodoMVC', | 33 'AngularJS-TodoMVC', |
34 'React-TodoMVC', | 34 'React-TodoMVC', |
35 'FlightJS-TodoMVC' | 35 'FlightJS-TodoMVC' |
36 ] | 36 ] |
37 | 37 |
38 def ValidateAndMeasurePage(self, page, tab, results): | 38 def ValidateAndMeasurePage(self, page, tab, results): |
39 tab.WaitForDocumentReadyStateToBeComplete() | 39 tab.WaitForDocumentReadyStateToBeComplete() |
| 40 iterationCount = 10 |
| 41 # A single iteration on android takes ~75 seconds, the benchmark times out |
| 42 # when running for 10 iterations. |
| 43 if tab.browser.platform.GetOSName() == 'android': |
| 44 iterationCount = 3 |
| 45 |
40 tab.ExecuteJavaScript(""" | 46 tab.ExecuteJavaScript(""" |
41 // Store all the results in the benchmarkClient | 47 // Store all the results in the benchmarkClient |
42 benchmarkClient._measuredValues = [] | 48 benchmarkClient._measuredValues = [] |
43 benchmarkClient.didRunSuites = function(measuredValues) { | 49 benchmarkClient.didRunSuites = function(measuredValues) { |
44 benchmarkClient._measuredValues.push(measuredValues); | 50 benchmarkClient._measuredValues.push(measuredValues); |
45 benchmarkClient._timeValues.push(measuredValues.total); | 51 benchmarkClient._timeValues.push(measuredValues.total); |
46 }; | 52 }; |
47 benchmarkClient.iterationCount = 10; | 53 benchmarkClient.iterationCount = %d; |
48 startTest(); | 54 startTest(); |
49 """) | 55 """ % iterationCount) |
50 tab.WaitForJavaScriptExpression( | 56 tab.WaitForJavaScriptExpression( |
51 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) | 57 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) |
52 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 58 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
53 page, 'Total', 'ms', | 59 page, 'Total', 'ms', |
54 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True)) | 60 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True)) |
55 | 61 |
56 # Extract the timings for each suite | 62 # Extract the timings for each suite |
57 for suite_name in self.enabled_suites: | 63 for suite_name in self.enabled_suites: |
58 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 64 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
59 page, suite_name, 'ms', | 65 page, suite_name, 'ms', |
60 tab.EvaluateJavaScript(""" | 66 tab.EvaluateJavaScript(""" |
61 var suite_times = []; | 67 var suite_times = []; |
62 for(var i = 0; i < benchmarkClient.iterationCount; i++) { | 68 for(var i = 0; i < benchmarkClient.iterationCount; i++) { |
63 suite_times.push( | 69 suite_times.push( |
64 benchmarkClient._measuredValues[i].tests['%s'].total); | 70 benchmarkClient._measuredValues[i].tests['%s'].total); |
65 }; | 71 }; |
66 suite_times; | 72 suite_times; |
67 """ % suite_name), important=False)) | 73 """ % suite_name), important=False)) |
68 | 74 |
69 @benchmark.Disabled('android') # Times out | |
70 class Speedometer(benchmark.Benchmark): | 75 class Speedometer(benchmark.Benchmark): |
71 test = SpeedometerMeasurement | 76 test = SpeedometerMeasurement |
72 | 77 |
73 def CreatePageSet(self, options): | 78 def CreatePageSet(self, options): |
74 ps = page_set.PageSet( | 79 ps = page_set.PageSet( |
75 file_path=os.path.abspath(__file__), | 80 file_path=os.path.abspath(__file__), |
76 archive_data_file='../page_sets/data/speedometer.json', | 81 archive_data_file='../page_sets/data/speedometer.json', |
77 make_javascript_deterministic=False) | 82 make_javascript_deterministic=False) |
78 ps.AddPageWithDefaultRunNavigate('http://browserbench.org/Speedometer/') | 83 ps.AddPageWithDefaultRunNavigate('http://browserbench.org/Speedometer/') |
79 return ps | 84 return ps |
OLD | NEW |