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 import collections | 4 import collections |
5 import json | 5 import json |
6 import os | 6 import os |
7 | 7 |
8 from metrics import power | 8 from metrics import power |
9 from telemetry import benchmark | 9 from telemetry import benchmark |
10 from telemetry import page as page_module | 10 from telemetry import page as page_module |
11 from telemetry.page import page_set | 11 from telemetry.page import page_set |
12 from telemetry.page import page_test | 12 from telemetry.page import page_test |
| 13 from telemetry.value import improvement_direction |
13 from telemetry.value import list_of_scalar_values | 14 from telemetry.value import list_of_scalar_values |
14 | 15 |
15 | 16 |
16 _URL = 'http://www.webkit.org/perf/sunspider-1.0.2/sunspider-1.0.2/driver.html' | 17 _URL = 'http://www.webkit.org/perf/sunspider-1.0.2/sunspider-1.0.2/driver.html' |
17 | 18 |
18 DESCRIPTIONS = { | 19 DESCRIPTIONS = { |
19 '3d-cube': | 20 '3d-cube': |
20 'Pure JavaScript computations of the kind you might use to do 3d ' | 21 'Pure JavaScript computations of the kind you might use to do 3d ' |
21 'rendering, but without the rendering. This ends up mostly hitting ' | 22 'rendering, but without the rendering. This ends up mostly hitting ' |
22 'floating point math and array access.', | 23 'floating point math and array access.', |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 totals = [] | 112 totals = [] |
112 for result in js_results: | 113 for result in js_results: |
113 total = 0 | 114 total = 0 |
114 for key, value in result.iteritems(): | 115 for key, value in result.iteritems(): |
115 r[key].append(value) | 116 r[key].append(value) |
116 total += value | 117 total += value |
117 totals.append(total) | 118 totals.append(total) |
118 for key, values in r.iteritems(): | 119 for key, values in r.iteritems(): |
119 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 120 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
120 results.current_page, key, 'ms', values, important=False, | 121 results.current_page, key, 'ms', values, important=False, |
121 description=DESCRIPTIONS.get(key))) | 122 description=DESCRIPTIONS.get(key), |
| 123 improvement_direction=improvement_direction.DOWN)) |
122 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 124 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
123 results.current_page, 'Total', 'ms', totals, | 125 results.current_page, 'Total', 'ms', totals, |
124 description='Totals of run time for each different type of benchmark ' | 126 description='Totals of run time for each different type of benchmark ' |
125 'in sunspider')) | 127 'in sunspider', |
| 128 improvement_direction=improvement_direction.DOWN)) |
126 | 129 |
127 | 130 |
128 class Sunspider(benchmark.Benchmark): | 131 class Sunspider(benchmark.Benchmark): |
129 """Apple's SunSpider JavaScript benchmark. | 132 """Apple's SunSpider JavaScript benchmark. |
130 | 133 |
131 http://www.webkit.org/perf/sunspider/sunspider.html | 134 http://www.webkit.org/perf/sunspider/sunspider.html |
132 """ | 135 """ |
133 test = _SunspiderMeasurement | 136 test = _SunspiderMeasurement |
134 | 137 |
135 def CreatePageSet(self, options): | 138 def CreatePageSet(self, options): |
136 ps = page_set.PageSet( | 139 ps = page_set.PageSet( |
137 archive_data_file='../page_sets/data/sunspider.json', | 140 archive_data_file='../page_sets/data/sunspider.json', |
138 file_path=os.path.abspath(__file__), | 141 file_path=os.path.abspath(__file__), |
139 bucket=page_set.PARTNER_BUCKET) | 142 bucket=page_set.PARTNER_BUCKET) |
140 ps.AddUserStory(page_module.Page( | 143 ps.AddUserStory(page_module.Page( |
141 _URL, ps, ps.base_dir, make_javascript_deterministic=False)) | 144 _URL, ps, ps.base_dir, make_javascript_deterministic=False)) |
142 return ps | 145 return ps |
OLD | NEW |