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 from telemetry import test | 17 from telemetry import benchmark |
18 from telemetry.page import page_measurement | 18 from telemetry.page import page_measurement |
19 from telemetry.page import page_set | 19 from telemetry.page import page_set |
20 from telemetry.util import statistics | 20 from telemetry.util import statistics |
21 from telemetry.value import merge_values | 21 from telemetry.value import merge_values |
22 from telemetry.value import scalar | 22 from telemetry.value import scalar |
23 | 23 |
24 class _PeaceKeeperMeasurement(page_measurement.PageMeasurement): | 24 class _PeaceKeeperMeasurement(page_measurement.PageMeasurement): |
25 | 25 |
26 def WillNavigateToPage(self, page, tab): | 26 def WillNavigateToPage(self, page, tab): |
27 page.script_to_evaluate_on_commit = """ | 27 page.script_to_evaluate_on_commit = """ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 # Calculate geometric mean as the total for the combined tests. | 61 # Calculate geometric mean as the total for the combined tests. |
62 combined = merge_values.MergeLikeValuesFromDifferentPages( | 62 combined = merge_values.MergeLikeValuesFromDifferentPages( |
63 results.all_page_specific_values, | 63 results.all_page_specific_values, |
64 group_by_name_suffix=True) | 64 group_by_name_suffix=True) |
65 combined_score = [x for x in combined if x.name == 'Score'][0] | 65 combined_score = [x for x in combined if x.name == 'Score'][0] |
66 total = statistics.GeometricMean(combined_score.values) | 66 total = statistics.GeometricMean(combined_score.values) |
67 results.AddSummaryValue( | 67 results.AddSummaryValue( |
68 scalar.ScalarValue(None, 'Total.Score', 'score', total)) | 68 scalar.ScalarValue(None, 'Total.Score', 'score', total)) |
69 | 69 |
70 | 70 |
71 class PeaceKeeperBenchmark(test.Test): | 71 class PeaceKeeperBenchmark(benchmark.Benchmark): |
72 """A base class for Peackeeper benchmarks.""" | 72 """A base class for Peackeeper benchmarks.""" |
73 test = _PeaceKeeperMeasurement | 73 test = _PeaceKeeperMeasurement |
74 | 74 |
75 def CreatePageSet(self, options): | 75 def CreatePageSet(self, options): |
76 """Makes a PageSet for PeaceKeeper benchmarks.""" | 76 """Makes a PageSet for PeaceKeeper benchmarks.""" |
77 # Subclasses are expected to define a class member called query_param. | 77 # Subclasses are expected to define a class member called query_param. |
78 if not hasattr(self, 'test_param'): | 78 if not hasattr(self, 'test_param'): |
79 raise NotImplementedError('test_param not in PeaceKeeper benchmark.') | 79 raise NotImplementedError('test_param not in PeaceKeeper benchmark.') |
80 | 80 |
81 ps = page_set.PageSet( | 81 ps = page_set.PageSet( |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 tag = 'html5' | 239 tag = 'html5' |
240 test_param = ['webglSphere', | 240 test_param = ['webglSphere', |
241 'gamingSpitfire', | 241 'gamingSpitfire', |
242 'videoCodecH264', | 242 'videoCodecH264', |
243 'videoCodecTheora', | 243 'videoCodecTheora', |
244 'videoCodecWebM', | 244 'videoCodecWebM', |
245 'videoPosterSupport', | 245 'videoPosterSupport', |
246 'workerContrast01', | 246 'workerContrast01', |
247 'workerContrast02' | 247 'workerContrast02' |
248 ] | 248 ] |
OLD | NEW |