| 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 20 matching lines...) Expand all Loading... |
| 31 from telemetry.page import page_set | 31 from telemetry.page import page_set |
| 32 | 32 |
| 33 _V8_COUNTER_NAMES = [ | 33 _V8_COUNTER_NAMES = [ |
| 34 'V8.OsMemoryAllocated', | 34 'V8.OsMemoryAllocated', |
| 35 ] | 35 ] |
| 36 | 36 |
| 37 class _IndexedDbMeasurement(page_measurement.PageMeasurement): | 37 class _IndexedDbMeasurement(page_measurement.PageMeasurement): |
| 38 def __init__(self, *args, **kwargs): | 38 def __init__(self, *args, **kwargs): |
| 39 super(_IndexedDbMeasurement, self).__init__(*args, **kwargs) | 39 super(_IndexedDbMeasurement, self).__init__(*args, **kwargs) |
| 40 self._memory_metric = None | 40 self._memory_metric = None |
| 41 self._power_metric = power.PowerMetric() | 41 self._power_metric = None |
| 42 self._v8_object_stats_metric = None | 42 self._v8_object_stats_metric = None |
| 43 | 43 |
| 44 def WillStartBrowser(self, browser): |
| 45 """Initialize metrics once right before the browser has been launched.""" |
| 46 self._power_metric = power.PowerMetric(browser) |
| 47 |
| 44 def DidStartBrowser(self, browser): | 48 def DidStartBrowser(self, browser): |
| 45 """Initialize metrics once right after the browser has been launched.""" | 49 """Initialize metrics once right after the browser has been launched.""" |
| 46 self._memory_metric = memory.MemoryMetric(browser) | 50 self._memory_metric = memory.MemoryMetric(browser) |
| 47 self._v8_object_stats_metric = ( | 51 self._v8_object_stats_metric = ( |
| 48 v8_object_stats.V8ObjectStatsMetric(_V8_COUNTER_NAMES)) | 52 v8_object_stats.V8ObjectStatsMetric(_V8_COUNTER_NAMES)) |
| 49 | 53 |
| 50 def DidNavigateToPage(self, page, tab): | 54 def DidNavigateToPage(self, page, tab): |
| 51 self._memory_metric.Start(page, tab) | 55 self._memory_metric.Start(page, tab) |
| 52 self._power_metric.Start(page, tab) | 56 self._power_metric.Start(page, tab) |
| 53 self._v8_object_stats_metric.Start(page, tab) | 57 self._v8_object_stats_metric.Start(page, tab) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 84 class IndexedDb(benchmark.Benchmark): | 88 class IndexedDb(benchmark.Benchmark): |
| 85 """Chromium's IndexedDB Performance tests.""" | 89 """Chromium's IndexedDB Performance tests.""" |
| 86 test = _IndexedDbMeasurement | 90 test = _IndexedDbMeasurement |
| 87 | 91 |
| 88 def CreatePageSet(self, options): | 92 def CreatePageSet(self, options): |
| 89 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', | 93 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', |
| 90 'data', 'indexeddb') | 94 'data', 'indexeddb') |
| 91 ps = page_set.PageSet(file_path=indexeddb_dir) | 95 ps = page_set.PageSet(file_path=indexeddb_dir) |
| 92 ps.AddPageWithDefaultRunNavigate('file://perf_test.html') | 96 ps.AddPageWithDefaultRunNavigate('file://perf_test.html') |
| 93 return ps | 97 return ps |
| OLD | NEW |