OLD | NEW |
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 import page as page_module | 11 from telemetry import page as page_module |
12 from telemetry.page import page_set | 12 from telemetry.page import page_set |
13 from telemetry.page import page_test | 13 from telemetry.page import page_test |
| 14 from telemetry.value import improvement_direction |
14 from telemetry.value import list_of_scalar_values | 15 from telemetry.value import list_of_scalar_values |
15 from telemetry.value import scalar | 16 from telemetry.value import scalar |
16 | 17 |
17 DESCRIPTIONS = { | 18 DESCRIPTIONS = { |
18 'ai-astar': | 19 'ai-astar': |
19 'This benchmark uses the [A* search algorithm]' | 20 'This benchmark uses the [A* search algorithm]' |
20 '(http://en.wikipedia.org/wiki/A*_search_algorithm) to automatically ' | 21 '(http://en.wikipedia.org/wiki/A*_search_algorithm) to automatically ' |
21 'plot an efficient path between two points, in the presence of ' | 22 'plot an efficient path between two points, in the presence of ' |
22 'obstacles. Adapted from code by [Brian Gringstead]' | 23 'obstacles. Adapted from code by [Brian Gringstead]' |
23 '(http://www.briangrinstead.com/blog/astar-search-algorithm-in-' | 24 '(http://www.briangrinstead.com/blog/astar-search-algorithm-in-' |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 var formElement = document.getElementsByTagName("input")[0]; | 94 var formElement = document.getElementsByTagName("input")[0]; |
94 decodeURIComponent(formElement.value.split("?")[1]); | 95 decodeURIComponent(formElement.value.split("?")[1]); |
95 """ | 96 """ |
96 result_dict = eval(tab.EvaluateJavaScript(js_get_results)) | 97 result_dict = eval(tab.EvaluateJavaScript(js_get_results)) |
97 total = 0 | 98 total = 0 |
98 for key in result_dict: | 99 for key in result_dict: |
99 if key == 'v': | 100 if key == 'v': |
100 continue | 101 continue |
101 results.AddValue(list_of_scalar_values.ListOfScalarValues( | 102 results.AddValue(list_of_scalar_values.ListOfScalarValues( |
102 results.current_page, key, 'ms', result_dict[key], important=False, | 103 results.current_page, key, 'ms', result_dict[key], important=False, |
103 description=DESCRIPTIONS.get(key))) | 104 description=DESCRIPTIONS.get(key), |
| 105 improvement_direction=improvement_direction.DOWN)) |
104 total += _Mean(result_dict[key]) | 106 total += _Mean(result_dict[key]) |
105 | 107 |
106 # TODO(tonyg/nednguyen): This measurement shouldn't calculate Total. The | 108 # TODO(tonyg/nednguyen): This measurement shouldn't calculate Total. The |
107 # results system should do that for us. | 109 # results system should do that for us. |
108 results.AddValue(scalar.ScalarValue( | 110 results.AddValue(scalar.ScalarValue( |
109 results.current_page, 'Total', 'ms', total, | 111 results.current_page, 'Total', 'ms', total, |
110 description='Total of the means of the results for each type ' | 112 description='Total of the means of the results for each type ' |
111 'of benchmark in [Mozilla\'s Kraken JavaScript benchmark]' | 113 'of benchmark in [Mozilla\'s Kraken JavaScript benchmark]' |
112 '(http://krakenbenchmark.mozilla.org/)')) | 114 '(http://krakenbenchmark.mozilla.org/)', |
| 115 improvement_direction=improvement_direction.DOWN)) |
113 | 116 |
114 | 117 |
115 class Kraken(benchmark.Benchmark): | 118 class Kraken(benchmark.Benchmark): |
116 """Mozilla's Kraken JavaScript benchmark. | 119 """Mozilla's Kraken JavaScript benchmark. |
117 | 120 |
118 http://krakenbenchmark.mozilla.org/ | 121 http://krakenbenchmark.mozilla.org/ |
119 """ | 122 """ |
120 test = _KrakenMeasurement | 123 test = _KrakenMeasurement |
121 | 124 |
122 def CreatePageSet(self, options): | 125 def CreatePageSet(self, options): |
123 ps = page_set.PageSet( | 126 ps = page_set.PageSet( |
124 archive_data_file='../page_sets/data/kraken.json', | 127 archive_data_file='../page_sets/data/kraken.json', |
125 file_path=os.path.abspath(__file__), | 128 file_path=os.path.abspath(__file__), |
126 bucket=page_set.PARTNER_BUCKET) | 129 bucket=page_set.PARTNER_BUCKET) |
127 ps.AddUserStory(page_module.Page( | 130 ps.AddUserStory(page_module.Page( |
128 'http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html', | 131 'http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html', |
129 ps, ps.base_dir)) | 132 ps, ps.base_dir)) |
130 return ps | 133 return ps |
OLD | NEW |