OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """PeaceKeeper benchmark suite. | 5 """PeaceKeeper benchmark suite. |
6 | 6 |
7 Peacekeeper measures browser's performance by testing its JavaScript | 7 Peacekeeper measures browser's performance by testing its JavaScript |
8 functionality. JavaScript is a widely used programming language used in the | 8 functionality. JavaScript is a widely used programming language used in the |
9 creation of modern websites to provide features such as animation, navigation, | 9 creation of modern websites to provide features such as animation, navigation, |
10 forms and other common requirements. By measuring a browser's ability to handle | 10 forms and other common requirements. By measuring a browser's ability to handle |
11 commonly used JavaScript functions Peacekeeper can evaluate its performance. | 11 commonly used JavaScript functions Peacekeeper can evaluate its performance. |
12 Peacekeeper scores are measured in operations per second or rendered frames per | 12 Peacekeeper scores are measured in operations per second or rendered frames per |
13 second depending on the test. Final Score is computed by calculating geometric | 13 second depending on the test. Final Score is computed by calculating geometric |
14 mean of individual tests scores. | 14 mean of individual tests scores. |
15 """ | 15 """ |
16 | 16 |
17 import os | |
18 | |
19 from telemetry import test | 17 from telemetry import test |
20 from telemetry.page import page_measurement | 18 from telemetry.page import page_measurement |
21 from telemetry.page import page_set | 19 from telemetry.page import page_set |
22 from telemetry.util import statistics | 20 from telemetry.util import statistics |
23 from telemetry.value import merge_values | 21 from telemetry.value import merge_values |
24 from telemetry.value import scalar | 22 from telemetry.value import scalar |
25 | 23 |
26 class _PeaceKeeperMeasurement(page_measurement.PageMeasurement): | 24 class _PeaceKeeperMeasurement(page_measurement.PageMeasurement): |
27 | 25 |
28 def WillNavigateToPage(self, page, tab): | 26 def WillNavigateToPage(self, page, tab): |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 74 |
77 def CreatePageSet(self, options): | 75 def CreatePageSet(self, options): |
78 """Makes a PageSet for PeaceKeeper benchmarks.""" | 76 """Makes a PageSet for PeaceKeeper benchmarks.""" |
79 # Subclasses are expected to define a class member called query_param. | 77 # Subclasses are expected to define a class member called query_param. |
80 if not hasattr(self, 'test_param'): | 78 if not hasattr(self, 'test_param'): |
81 raise NotImplementedError('test_param not in PeaceKeeper benchmark.') | 79 raise NotImplementedError('test_param not in PeaceKeeper benchmark.') |
82 | 80 |
83 # The docstring of benchmark classes may also be used as a description | 81 # The docstring of benchmark classes may also be used as a description |
84 # when 'run_benchmarks list' is run. | 82 # when 'run_benchmarks list' is run. |
85 description = self.__doc__ or 'PeaceKeeper Benchmark' | 83 description = self.__doc__ or 'PeaceKeeper Benchmark' |
86 test_urls = [] | 84 ps = page_set.PageSet( |
| 85 description=description, |
| 86 archive_data_file='../page_sets/data/peacekeeper_%s.json' % self.tag, |
| 87 make_javascript_deterministic=False) |
87 for test_name in self.test_param: | 88 for test_name in self.test_param: |
88 test_urls.append( | 89 ps.AddPageWithDefaultRunNavigate( |
89 {"url": ("http://peacekeeper.futuremark.com/run.action?debug=true&" | 90 ('http://peacekeeper.futuremark.com/run.action?debug=true&' |
90 "repeat=false&forceSuiteName=%s&forceTestName=%s") % | 91 'repeat=false&forceSuiteName=%s&forceTestName=%s') % |
91 (self.tag, test_name) | 92 (self.tag, test_name)) |
92 }) | 93 return ps |
93 | |
94 page_set_dict = { | |
95 'description': description, | |
96 'archive_data_file': '../page_sets/data/peacekeeper_%s.json' % self.tag, | |
97 'make_javascript_deterministic': False, | |
98 'pages': test_urls, | |
99 } | |
100 return page_set.PageSet.FromDict(page_set_dict, os.path.abspath(__file__)) | |
101 | 94 |
102 | 95 |
103 class PeaceKeeperRender(PeaceKeeperBenchmark): | 96 class PeaceKeeperRender(PeaceKeeperBenchmark): |
104 """PeaceKeeper rendering benchmark suite. | 97 """PeaceKeeper rendering benchmark suite. |
105 | 98 |
106 These tests measure your browser's ability to render and modify specific | 99 These tests measure your browser's ability to render and modify specific |
107 elements used in typical web pages. Rendering tests manipulate the DOM tree in | 100 elements used in typical web pages. Rendering tests manipulate the DOM tree in |
108 real-time. The tests measure display updating speed (frames per seconds). | 101 real-time. The tests measure display updating speed (frames per seconds). |
109 """ | 102 """ |
110 tag = 'render' | 103 tag = 'render' |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 tag = 'html5' | 243 tag = 'html5' |
251 test_param = ['webglSphere', | 244 test_param = ['webglSphere', |
252 'gamingSpitfire', | 245 'gamingSpitfire', |
253 'videoCodecH264', | 246 'videoCodecH264', |
254 'videoCodecTheora', | 247 'videoCodecTheora', |
255 'videoCodecWebM', | 248 'videoCodecWebM', |
256 'videoPosterSupport', | 249 'videoPosterSupport', |
257 'workerContrast01', | 250 'workerContrast01', |
258 'workerContrast02' | 251 'workerContrast02' |
259 ] | 252 ] |
OLD | NEW |