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 25 matching lines...) Expand all Loading... |
36 'AngularJS-TodoMVC', | 36 'AngularJS-TodoMVC', |
37 'React-TodoMVC', | 37 'React-TodoMVC', |
38 'FlightJS-TodoMVC' | 38 'FlightJS-TodoMVC' |
39 ] | 39 ] |
40 | 40 |
41 def __init__(self): | 41 def __init__(self): |
42 super(SpeedometerMeasurement, self).__init__() | 42 super(SpeedometerMeasurement, self).__init__() |
43 | 43 |
44 def CustomizeBrowserOptions(self, options): | 44 def CustomizeBrowserOptions(self, options): |
45 keychain_metric.KeychainMetric.CustomizeBrowserOptions(options) | 45 keychain_metric.KeychainMetric.CustomizeBrowserOptions(options) |
46 options.AppendExtraBrowserArgs(['--js-flags=--expose_gc']) | |
47 | 46 |
48 def ValidateAndMeasurePage(self, page, tab, results): | 47 def ValidateAndMeasurePage(self, page, tab, results): |
49 tab.WaitForDocumentReadyStateToBeComplete() | 48 tab.WaitForDocumentReadyStateToBeComplete() |
50 iterationCount = 10 | 49 iterationCount = 10 |
51 # A single iteration on android takes ~75 seconds, the benchmark times out | 50 # A single iteration on android takes ~75 seconds, the benchmark times out |
52 # when running for 10 iterations. | 51 # when running for 10 iterations. |
53 if tab.browser.platform.GetOSName() == 'android': | 52 if tab.browser.platform.GetOSName() == 'android': |
54 iterationCount = 3 | 53 iterationCount = 3 |
55 | 54 |
56 tab.ExecuteJavaScript(""" | 55 tab.ExecuteJavaScript(""" |
57 // Store all the results in the benchmarkClient | 56 // Store all the results in the benchmarkClient |
58 benchmarkClient._measuredValues = [] | 57 benchmarkClient._measuredValues = [] |
59 benchmarkClient.didRunSuites = function(measuredValues) { | 58 benchmarkClient.didRunSuites = function(measuredValues) { |
60 benchmarkClient._measuredValues.push(measuredValues); | 59 benchmarkClient._measuredValues.push(measuredValues); |
61 benchmarkClient._timeValues.push(measuredValues.total); | 60 benchmarkClient._timeValues.push(measuredValues.total); |
62 }; | 61 }; |
63 benchmarkClient.willRunTest = function(suite, test) { | |
64 for (var i = 0; i < 5; i++) { | |
65 gc(); | |
66 } | |
67 }; | |
68 benchmarkClient.iterationCount = %d; | 62 benchmarkClient.iterationCount = %d; |
69 startTest(); | 63 startTest(); |
70 """ % iterationCount) | 64 """ % iterationCount) |
71 tab.WaitForJavaScriptExpression( | 65 tab.WaitForJavaScriptExpression( |
72 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) | 66 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) |
73 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 67 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
74 page, 'Total', 'ms', | 68 page, 'Total', 'ms', |
75 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True)) | 69 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True)) |
76 | 70 |
77 # Extract the timings for each suite | 71 # Extract the timings for each suite |
(...skipping 19 matching lines...) Expand all Loading... |
97 | 91 |
98 def CreatePageSet(self, options): | 92 def CreatePageSet(self, options): |
99 ps = page_set.PageSet( | 93 ps = page_set.PageSet( |
100 file_path=os.path.abspath(__file__), | 94 file_path=os.path.abspath(__file__), |
101 archive_data_file='../page_sets/data/speedometer.json', | 95 archive_data_file='../page_sets/data/speedometer.json', |
102 bucket=page_set.PUBLIC_BUCKET) | 96 bucket=page_set.PUBLIC_BUCKET) |
103 ps.AddUserStory(page_module.Page( | 97 ps.AddUserStory(page_module.Page( |
104 'http://browserbench.org/Speedometer/', ps, ps.base_dir, | 98 'http://browserbench.org/Speedometer/', ps, ps.base_dir, |
105 make_javascript_deterministic=False)) | 99 make_javascript_deterministic=False)) |
106 return ps | 100 return ps |
OLD | NEW |