Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: tools/perf/benchmarks/sunspider.py

Issue 714273004: mac: Expose keychain access frequency to Telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_keychain_sleep
Patch Set: Add a common subclass to measurements. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 measurements import PageTestMeasurement
8 from metrics import power 9 from metrics import power
9 from telemetry import benchmark 10 from telemetry import benchmark
10 from telemetry.page import page_set 11 from telemetry.page import page_set
11 from telemetry.page import page_test
12 from telemetry.value import list_of_scalar_values 12 from telemetry.value import list_of_scalar_values
13 13
14 14
15 _URL = 'http://www.webkit.org/perf/sunspider-1.0.2/sunspider-1.0.2/driver.html' 15 _URL = 'http://www.webkit.org/perf/sunspider-1.0.2/sunspider-1.0.2/driver.html'
16 16
17 DESCRIPTIONS = { 17 DESCRIPTIONS = {
18 '3d-cube': 18 '3d-cube':
19 'Pure JavaScript computations of the kind you might use to do 3d ' 19 'Pure JavaScript computations of the kind you might use to do 3d '
20 'rendering, but without the rendering. This ends up mostly hitting ' 20 'rendering, but without the rendering. This ends up mostly hitting '
21 'floating point math and array access.', 21 'floating point math and array access.',
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 'math-spectral-norm': 'Various mathematical type computations.', 65 'math-spectral-norm': 'Various mathematical type computations.',
66 'regexp-dna': 'Regular expressions performance.', 66 'regexp-dna': 'Regular expressions performance.',
67 'string-base64': 'String processing.', 67 'string-base64': 'String processing.',
68 'string-fasta': 'String processing', 68 'string-fasta': 'String processing',
69 'string-tagcloud': 'String processing code to generate a giant "tagcloud".', 69 'string-tagcloud': 'String processing code to generate a giant "tagcloud".',
70 'string-unpack-code': 'String processing code to extracting compressed JS.', 70 'string-unpack-code': 'String processing code to extracting compressed JS.',
71 'string-validate-input': 'String processing.', 71 'string-validate-input': 'String processing.',
72 } 72 }
73 73
74 74
75 class _SunspiderMeasurement(page_test.PageTest): 75 class _SunspiderMeasurement(PageTestMeasurement):
76 def __init__(self): 76 def __init__(self):
77 super(_SunspiderMeasurement, self).__init__() 77 super(_SunspiderMeasurement, self).__init__()
78 self._power_metric = None 78 self._power_metric = None
79 79
80 def CustomizeBrowserOptions(self, options): 80 def CustomizeBrowserOptions(self, options):
81 super(_SunspiderMeasurement, self).CustomizeBrowserOptions(options)
81 power.PowerMetric.CustomizeBrowserOptions(options) 82 power.PowerMetric.CustomizeBrowserOptions(options)
82 83
83 def WillStartBrowser(self, platform): 84 def WillStartBrowser(self, platform):
84 self._power_metric = power.PowerMetric(platform) 85 self._power_metric = power.PowerMetric(platform)
85 86
86 def DidNavigateToPage(self, page, tab): 87 def DidNavigateToPage(self, page, tab):
87 self._power_metric.Start(page, tab) 88 self._power_metric.Start(page, tab)
88 89
89 def ValidateAndMeasurePage(self, page, tab, results): 90 def ValidateAndMeasurePage(self, page, tab, results):
90 tab.WaitForJavaScriptExpression( 91 tab.WaitForJavaScriptExpression(
(...skipping 23 matching lines...) Expand all
114 total += value 115 total += value
115 totals.append(total) 116 totals.append(total)
116 for key, values in r.iteritems(): 117 for key, values in r.iteritems():
117 results.AddValue(list_of_scalar_values.ListOfScalarValues( 118 results.AddValue(list_of_scalar_values.ListOfScalarValues(
118 results.current_page, key, 'ms', values, important=False, 119 results.current_page, key, 'ms', values, important=False,
119 description=DESCRIPTIONS.get(key))) 120 description=DESCRIPTIONS.get(key)))
120 results.AddValue(list_of_scalar_values.ListOfScalarValues( 121 results.AddValue(list_of_scalar_values.ListOfScalarValues(
121 results.current_page, 'Total', 'ms', totals, 122 results.current_page, 'Total', 'ms', totals,
122 description='Totals of run time for each different type of benchmark ' 123 description='Totals of run time for each different type of benchmark '
123 'in sunspider')) 124 'in sunspider'))
125 super(_SunspiderMeasurement, self).ValidateAndMeasurePage(
126 page, tab, results)
124 127
125 128
126 class Sunspider(benchmark.Benchmark): 129 class Sunspider(benchmark.Benchmark):
127 """Apple's SunSpider JavaScript benchmark.""" 130 """Apple's SunSpider JavaScript benchmark."""
128 test = _SunspiderMeasurement 131 test = _SunspiderMeasurement
129 132
130 def CreatePageSet(self, options): 133 def CreatePageSet(self, options):
131 ps = page_set.PageSet( 134 ps = page_set.PageSet(
132 archive_data_file='../page_sets/data/sunspider.json', 135 archive_data_file='../page_sets/data/sunspider.json',
133 make_javascript_deterministic=False, 136 make_javascript_deterministic=False,
134 file_path=os.path.abspath(__file__)) 137 file_path=os.path.abspath(__file__))
135 ps.AddPageWithDefaultRunNavigate(_URL) 138 ps.AddPageWithDefaultRunNavigate(_URL)
136 return ps 139 return ps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698