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 | 4 |
5 """Runs Chromium's IndexedDB performance test. These test: | 5 """Runs Chromium's IndexedDB performance test. These test: |
6 | 6 |
7 Databases: | 7 Databases: |
8 create/delete | 8 create/delete |
9 Keys: | 9 Keys: |
10 create/delete | 10 create/delete |
(...skipping 12 matching lines...) Expand all Loading... |
23 import os | 23 import os |
24 | 24 |
25 from metrics import memory | 25 from metrics import memory |
26 from metrics import power | 26 from metrics import power |
27 from metrics import v8_object_stats | 27 from metrics import v8_object_stats |
28 from telemetry import benchmark | 28 from telemetry import benchmark |
29 from telemetry import page as page_module | 29 from telemetry import page as page_module |
30 from telemetry.core import util | 30 from telemetry.core import util |
31 from telemetry.page import page_set | 31 from telemetry.page import page_set |
32 from telemetry.page import page_test | 32 from telemetry.page import page_test |
| 33 from telemetry.value import improvement_direction |
33 from telemetry.value import scalar | 34 from telemetry.value import scalar |
34 | 35 |
35 _V8_COUNTER_NAMES = [ | 36 _V8_COUNTER_NAMES = [ |
36 'V8.OsMemoryAllocated', | 37 'V8.OsMemoryAllocated', |
37 ] | 38 ] |
38 | 39 |
39 class _IndexedDbMeasurement(page_test.PageTest): | 40 class _IndexedDbMeasurement(page_test.PageTest): |
40 def __init__(self): | 41 def __init__(self): |
41 super(_IndexedDbMeasurement, self).__init__( | 42 super(_IndexedDbMeasurement, self).__init__( |
42 action_name_to_run='RunPageInteractions') | 43 action_name_to_run='RunPageInteractions') |
(...skipping 30 matching lines...) Expand all Loading... |
73 self._v8_object_stats_metric.AddResults(tab, results) | 74 self._v8_object_stats_metric.AddResults(tab, results) |
74 | 75 |
75 js_get_results = "JSON.stringify(automation.getResults());" | 76 js_get_results = "JSON.stringify(automation.getResults());" |
76 result_dict = json.loads(tab.EvaluateJavaScript(js_get_results)) | 77 result_dict = json.loads(tab.EvaluateJavaScript(js_get_results)) |
77 total = 0.0 | 78 total = 0.0 |
78 for key in result_dict: | 79 for key in result_dict: |
79 if key == 'OverallTestDuration': | 80 if key == 'OverallTestDuration': |
80 continue | 81 continue |
81 msec = float(result_dict[key]) | 82 msec = float(result_dict[key]) |
82 results.AddValue(scalar.ScalarValue( | 83 results.AddValue(scalar.ScalarValue( |
83 results.current_page, key, 'ms', msec, important=False)) | 84 results.current_page, key, 'ms', msec, important=False, |
| 85 improvement_direction=improvement_direction.DOWN)) |
84 | 86 |
85 total += msec | 87 total += msec |
86 results.AddValue(scalar.ScalarValue( | 88 results.AddValue(scalar.ScalarValue( |
87 results.current_page, 'Total Perf', 'ms', total)) | 89 results.current_page, 'Total Perf', 'ms', total, |
| 90 improvement_direction=improvement_direction.DOWN)) |
88 | 91 |
89 | 92 |
90 def CustomizeBrowserOptions(self, options): | 93 def CustomizeBrowserOptions(self, options): |
91 memory.MemoryMetric.CustomizeBrowserOptions(options) | 94 memory.MemoryMetric.CustomizeBrowserOptions(options) |
92 power.PowerMetric.CustomizeBrowserOptions(options) | 95 power.PowerMetric.CustomizeBrowserOptions(options) |
93 v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options) | 96 v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options) |
94 | 97 |
95 class IndexedDb(benchmark.Benchmark): | 98 class IndexedDb(benchmark.Benchmark): |
96 """Chromium's IndexedDB Performance tests.""" | 99 """Chromium's IndexedDB Performance tests.""" |
97 test = _IndexedDbMeasurement | 100 test = _IndexedDbMeasurement |
98 | 101 |
99 def CreatePageSet(self, options): | 102 def CreatePageSet(self, options): |
100 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', | 103 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', |
101 'data', 'indexeddb') | 104 'data', 'indexeddb') |
102 ps = page_set.PageSet(file_path=indexeddb_dir) | 105 ps = page_set.PageSet(file_path=indexeddb_dir) |
103 ps.AddUserStory(page_module.Page('file://perf_test.html', ps, ps.base_dir)) | 106 ps.AddUserStory(page_module.Page('file://perf_test.html', ps, ps.base_dir)) |
104 return ps | 107 return ps |
OLD | NEW |