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