OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Runs Apple's SunSpider JavaScript benchmark.""" | 5 """Runs Apple's SunSpider JavaScript benchmark.""" |
6 | 6 |
7 import collections | 7 import collections |
8 import json | 8 import json |
9 import os | 9 import os |
10 | 10 |
11 from telemetry.core import util | 11 from telemetry.core import util |
12 from telemetry.page import page_measurement | 12 from telemetry.page import page_measurement |
13 from telemetry.page import page_set | 13 from telemetry.page import page_set |
14 | 14 |
15 class SunSpiderMeasurement(page_measurement.PageMeasurement): | 15 class Sunspider(page_measurement.PageMeasurement): |
16 def CreatePageSet(self, _, options): | 16 def CreatePageSet(self, _, options): |
17 return page_set.PageSet.FromDict({ | 17 return page_set.PageSet.FromDict({ |
18 'serving_dirs': ['../../../chrome/test/data/sunspider/'], | 18 'serving_dirs': ['../../../chrome/test/data/sunspider/'], |
19 'pages': [ | 19 'pages': [ |
20 { 'url': 'file:///../../../chrome/test/data/sunspider/' | 20 { 'url': 'file:///../../../chrome/test/data/sunspider/' |
21 'sunspider-1.0/driver.html' } | 21 'sunspider-1.0/driver.html' } |
22 ] | 22 ] |
23 }, os.path.abspath(__file__)) | 23 }, os.path.abspath(__file__)) |
24 | 24 |
25 def MeasurePage(self, _, tab, results): | 25 def MeasurePage(self, _, tab, results): |
(...skipping 12 matching lines...) Expand all Loading... |
38 # ...] | 38 # ...] |
39 for result in js_results: | 39 for result in js_results: |
40 total = 0 | 40 total = 0 |
41 for key, value in result.iteritems(): | 41 for key, value in result.iteritems(): |
42 r[key].append(value) | 42 r[key].append(value) |
43 total += value | 43 total += value |
44 totals.append(total) | 44 totals.append(total) |
45 for key, values in r.iteritems(): | 45 for key, values in r.iteritems(): |
46 results.Add(key, 'ms', values, data_type='unimportant') | 46 results.Add(key, 'ms', values, data_type='unimportant') |
47 results.Add('Total', 'ms', totals) | 47 results.Add('Total', 'ms', totals) |
OLD | NEW |