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

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

Issue 391183002: Delete trace-info.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed descriptions in smoothness_controller. Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/perf/benchmarks/octane.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 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 Mozilla's Kraken JavaScript benchmark.""" 5 """Runs Mozilla's Kraken JavaScript benchmark."""
6 6
7 import os 7 import os
8 8
9 from metrics import power 9 from metrics import power
10 from telemetry import benchmark 10 from telemetry import benchmark
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 list_of_scalar_values 13 from telemetry.value import list_of_scalar_values
14 from telemetry.value import scalar 14 from telemetry.value import scalar
15 15
16 DESCRIPTIONS = {
17 'ai-astar':
18 'This benchmark uses the [A* search algorithm]'
19 '(http://en.wikipedia.org/wiki/A*_search_algorithm) to automatically '
20 'plot an efficient path between two points, in the presence of '
21 'obstacles. Adapted from code by [Brian Gringstead]'
22 '(http://www.briangrinstead.com/blog/astar-search-algorithm-in-'
23 'javascript).',
24 'audio-beat-detection':
25 'This benchmark performs [beat detection]'
26 '(http://en.wikipedia.org/wiki/Beat_detection) on an Audio sample '
27 'using [code](http://beatdetektor.svn.sourceforge.net/viewvc'
28 '/beatdetektor/trunk/core/js/beatdetektor.js?revision=18&view=markup) '
29 'from [BeatDetektor](http://www.cubicproductions.com/index.php'
30 '?option=com_content&view=article&id=67&Itemid=82) and '
31 '[DSP.js](http://github.com/corbanbrook/dsp.js/).',
32 'audio-dft':
33 'This benchmark performs a [Discrete Fourier Transform]'
34 '(http://en.wikipedia.org/wiki/Discrete_Fourier_transform) on an '
35 'Audio sample using code from [DSP.js]'
36 '(http://github.com/corbanbrook/dsp.js).',
37 'audio-fft':
38 'This benchmark performs a [Fast Fourier Transform]'
39 '(http://en.wikipedia.org/wiki/Fast_Fourier_transform) on an Audio '
40 'sample using code from [DSP.js]'
41 '(http://github.com/corbanbrook/dsp.js/).',
42 'audio-oscillator':
43 'This benchmark generates a soundwave using code from [DSP.js]'
44 '(http://github.com/corbanbrook/dsp.js/).',
45 'imaging-darkroom':
46 'This benchmark performs a variety of photo manipulations such as '
47 'Fill, Brightness, Contrast, Saturation, and Temperature.',
48 'imaging-desaturate':
49 'This benchmark [desaturates]'
50 '(http://en.wikipedia.org/wiki/Colorfulness) a photo using code from '
51 '[Pixastic](http://www.pixastic.com/).',
52 'imaging-gaussian-blur':
53 'This benchmark performs a [Gaussian blur]'
54 '(http://en.wikipedia.org/wiki/Gaussian_blur) on a photo.',
55 'json-parse-financial':
56 'This benchmark parses [JSON](http://www.json.org) records.',
57 'json-stringify-tinderbox':
58 'This benchmark serializes [Tinderbox]'
59 '(http://tests.themasta.com/tinderboxpushlog/?tree=Firefox) build '
60 'data to [JSON](http://www.json.org).',
61 }
62
16 63
17 def _Mean(l): 64 def _Mean(l):
18 return float(sum(l)) / len(l) if len(l) > 0 else 0.0 65 return float(sum(l)) / len(l) if len(l) > 0 else 0.0
19 66
20 67
21 class _KrakenMeasurement(page_measurement.PageMeasurement): 68 class _KrakenMeasurement(page_measurement.PageMeasurement):
22 def __init__(self): 69 def __init__(self):
23 super(_KrakenMeasurement, self).__init__() 70 super(_KrakenMeasurement, self).__init__()
24 self._power_metric = None 71 self._power_metric = None
25 72
26 def CustomizeBrowserOptions(self, options): 73 def CustomizeBrowserOptions(self, options):
27 power.PowerMetric.CustomizeBrowserOptions(options) 74 power.PowerMetric.CustomizeBrowserOptions(options)
28 75
29 def WillStartBrowser(self, browser): 76 def WillStartBrowser(self, browser):
30 self._power_metric = power.PowerMetric(browser) 77 self._power_metric = power.PowerMetric(browser)
31 78
32 def DidNavigateToPage(self, page, tab): 79 def DidNavigateToPage(self, page, tab):
33 self._power_metric.Start(page, tab) 80 self._power_metric.Start(page, tab)
34 81
35 def MeasurePage(self, page, tab, results): 82 def MeasurePage(self, page, tab, results):
36 tab.WaitForJavaScriptExpression( 83 tab.WaitForJavaScriptExpression(
37 'document.title.indexOf("Results") != -1', 700) 84 'document.title.indexOf("Results") != -1', 700)
38 tab.WaitForDocumentReadyStateToBeComplete() 85 tab.WaitForDocumentReadyStateToBeComplete()
39 86
40 self._power_metric.Stop(page, tab) 87 self._power_metric.Stop(page, tab)
41 self._power_metric.AddResults(tab, results) 88 self._power_metric.AddResults(tab, results)
42 89
43 js_get_results = """ 90 js_get_results = """
44 var formElement = document.getElementsByTagName("input")[0]; 91 var formElement = document.getElementsByTagName("input")[0];
45 decodeURIComponent(formElement.value.split("?")[1]); 92 decodeURIComponent(formElement.value.split("?")[1]);
46 """ 93 """
47 result_dict = eval(tab.EvaluateJavaScript(js_get_results)) 94 result_dict = eval(tab.EvaluateJavaScript(js_get_results))
48 total = 0 95 total = 0
49 for key in result_dict: 96 for key in result_dict:
50 if key == 'v': 97 if key == 'v':
51 continue 98 continue
52 results.AddValue(list_of_scalar_values.ListOfScalarValues( 99 results.AddValue(list_of_scalar_values.ListOfScalarValues(
53 results.current_page, key, 'ms', result_dict[key], important=False)) 100 results.current_page, key, 'ms', result_dict[key], important=False,
101 description=DESCRIPTIONS.get(key)))
54 total += _Mean(result_dict[key]) 102 total += _Mean(result_dict[key])
55 103
56 # TODO(tonyg/nednguyen): This measurement shouldn't calculate Total. The 104 # TODO(tonyg/nednguyen): This measurement shouldn't calculate Total. The
57 # results system should do that for us. 105 # results system should do that for us.
58 results.AddValue(scalar.ScalarValue( 106 results.AddValue(scalar.ScalarValue(
59 results.current_page, 'Total', 'ms', total)) 107 results.current_page, 'Total', 'ms', total,
108 description='Total of the means of the results for each type '
109 'of benchmark in [Mozilla\'s Kraken JavaScript benchmark]'
110 '(http://krakenbenchmark.mozilla.org/)'))
60 111
61 112
62 class Kraken(benchmark.Benchmark): 113 class Kraken(benchmark.Benchmark):
63 """Mozilla's Kraken JavaScript benchmark.""" 114 """Mozilla's Kraken JavaScript benchmark."""
64 test = _KrakenMeasurement 115 test = _KrakenMeasurement
65 116
66 def CreatePageSet(self, options): 117 def CreatePageSet(self, options):
67 ps = page_set.PageSet( 118 ps = page_set.PageSet(
68 archive_data_file='../page_sets/data/kraken.json', 119 archive_data_file='../page_sets/data/kraken.json',
69 file_path=os.path.abspath(__file__)) 120 file_path=os.path.abspath(__file__))
70 ps.AddPageWithDefaultRunNavigate( 121 ps.AddPageWithDefaultRunNavigate(
71 'http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html') 122 'http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html')
72 return ps 123 return ps
OLDNEW
« no previous file with comments | « no previous file | tools/perf/benchmarks/octane.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698