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 import json | 5 import json |
6 import math | 6 import math |
7 import os | 7 import os |
8 | 8 |
9 from telemetry import test | 9 from telemetry import benchmark |
10 from telemetry.core import util | 10 from telemetry.core import util |
11 from telemetry.page import page_measurement | 11 from telemetry.page import page_measurement |
12 from telemetry.page import page_set | 12 from telemetry.page import page_set |
13 from telemetry.value import merge_values | 13 from telemetry.value import merge_values |
14 from telemetry.value import scalar | 14 from telemetry.value import scalar |
15 | 15 |
16 | 16 |
17 def _GeometricMean(values): | 17 def _GeometricMean(values): |
18 """Compute a rounded geometric mean from an array of values.""" | 18 """Compute a rounded geometric mean from an array of values.""" |
19 if not values: | 19 if not values: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_TRACE_NAME][0] | 65 combined_score = [x for x in combined if x.name == SCORE_TRACE_NAME][0] |
66 total = _GeometricMean(combined_score.values) | 66 total = _GeometricMean(combined_score.values) |
67 results.AddSummaryValue( | 67 results.AddSummaryValue( |
68 scalar.ScalarValue(None, 'Total.' + SCORE_TRACE_NAME, SCORE_UNIT, | 68 scalar.ScalarValue(None, 'Total.' + SCORE_TRACE_NAME, SCORE_UNIT, |
69 total)) | 69 total)) |
70 | 70 |
71 | 71 |
72 @test.Disabled('android', 'linux') | 72 @benchmark.Disabled('android', 'linux') |
73 class DomPerf(test.Test): | 73 class DomPerf(benchmark.Benchmark): |
74 """A suite of JavaScript benchmarks for exercising the browser's DOM. | 74 """A suite of JavaScript benchmarks for exercising the browser's DOM. |
75 | 75 |
76 The final score is computed as the geometric mean of the individual results. | 76 The final score is computed as the geometric mean of the individual results. |
77 Scores are not comparable across benchmark suite versions and higher scores | 77 Scores are not comparable across benchmark suite versions and higher scores |
78 means better performance: Bigger is better!""" | 78 means better performance: Bigger is better!""" |
79 test = _DomPerfMeasurement | 79 test = _DomPerfMeasurement |
80 | 80 |
81 def CreatePageSet(self, options): | 81 def CreatePageSet(self, options): |
82 dom_perf_dir = os.path.join(util.GetChromiumSrcDir(), 'data', 'dom_perf') | 82 dom_perf_dir = os.path.join(util.GetChromiumSrcDir(), 'data', 'dom_perf') |
83 run_params = [ | 83 run_params = [ |
84 'Accessors', | 84 'Accessors', |
85 'CloneNodes', | 85 'CloneNodes', |
86 'CreateNodes', | 86 'CreateNodes', |
87 'DOMDivWalk', | 87 'DOMDivWalk', |
88 'DOMTable', | 88 'DOMTable', |
89 'DOMWalk', | 89 'DOMWalk', |
90 'Events', | 90 'Events', |
91 'Get+Elements', | 91 'Get+Elements', |
92 'GridSort', | 92 'GridSort', |
93 'Template' | 93 'Template' |
94 ] | 94 ] |
95 ps = page_set.PageSet(file_path=dom_perf_dir) | 95 ps = page_set.PageSet(file_path=dom_perf_dir) |
96 for param in run_params: | 96 for param in run_params: |
97 ps.AddPageWithDefaultRunNavigate( | 97 ps.AddPageWithDefaultRunNavigate( |
98 'file://run.html?reportInJS=1&run=%s' % param) | 98 'file://run.html?reportInJS=1&run=%s' % param) |
99 return ps | 99 return ps |
OLD | NEW |