| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 benchmarkClient._measuredValues.push(measuredValues); | 51 benchmarkClient._measuredValues.push(measuredValues); |
| 52 benchmarkClient._timeValues.push(measuredValues.total); | 52 benchmarkClient._timeValues.push(measuredValues.total); |
| 53 }; | 53 }; |
| 54 benchmarkClient.iterationCount = %d; | 54 benchmarkClient.iterationCount = %d; |
| 55 startTest(); | 55 startTest(); |
| 56 """ % iterationCount) | 56 """ % iterationCount) |
| 57 tab.WaitForJavaScriptExpression( | 57 tab.WaitForJavaScriptExpression( |
| 58 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) | 58 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) |
| 59 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 59 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
| 60 page, 'Total', 'ms', | 60 page, 'Total', 'ms', |
| 61 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True)) | 61 tab.EvaluateJavaScript('benchmarkClient._timeValues'), important=True, |
| 62 higher_is_better=False)) |
| 62 | 63 |
| 63 # Extract the timings for each suite | 64 # Extract the timings for each suite |
| 64 for suite_name in self.enabled_suites: | 65 for suite_name in self.enabled_suites: |
| 65 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 66 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
| 66 page, suite_name, 'ms', | 67 page, suite_name, 'ms', |
| 67 tab.EvaluateJavaScript(""" | 68 tab.EvaluateJavaScript(""" |
| 68 var suite_times = []; | 69 var suite_times = []; |
| 69 for(var i = 0; i < benchmarkClient.iterationCount; i++) { | 70 for(var i = 0; i < benchmarkClient.iterationCount; i++) { |
| 70 suite_times.push( | 71 suite_times.push( |
| 71 benchmarkClient._measuredValues[i].tests['%s'].total); | 72 benchmarkClient._measuredValues[i].tests['%s'].total); |
| 72 }; | 73 }; |
| 73 suite_times; | 74 suite_times; |
| 74 """ % suite_name), important=False)) | 75 """ % suite_name), important=False, higher_is_better=False)) |
| 75 | 76 |
| 76 class Speedometer(benchmark.Benchmark): | 77 class Speedometer(benchmark.Benchmark): |
| 77 test = SpeedometerMeasurement | 78 test = SpeedometerMeasurement |
| 78 | 79 |
| 79 def CreatePageSet(self, options): | 80 def CreatePageSet(self, options): |
| 80 ps = page_set.PageSet( | 81 ps = page_set.PageSet( |
| 81 file_path=os.path.abspath(__file__), | 82 file_path=os.path.abspath(__file__), |
| 82 archive_data_file='../page_sets/data/speedometer.json', | 83 archive_data_file='../page_sets/data/speedometer.json', |
| 83 bucket=page_set.PUBLIC_BUCKET) | 84 bucket=page_set.PUBLIC_BUCKET) |
| 84 ps.AddUserStory(page_module.Page( | 85 ps.AddUserStory(page_module.Page( |
| 85 'http://browserbench.org/Speedometer/', ps, ps.base_dir, | 86 'http://browserbench.org/Speedometer/', ps, ps.base_dir, |
| 86 make_javascript_deterministic=False)) | 87 make_javascript_deterministic=False)) |
| 87 return ps | 88 return ps |
| OLD | NEW |