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

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

Issue 123553003: Added memory and V8 metrics to indexeddb_perf results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-results
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
11 Indexes: 11 Indexes:
12 create/delete 12 create/delete
13 Data access: 13 Data access:
14 Random read/write 14 Random read/write
15 Sporadic writes 15 Sporadic writes
16 Read cache 16 Read cache
17 Cursors: 17 Cursors:
18 Read & random writes 18 Read & random writes
19 Walking multiple 19 Walking multiple
20 Seeking. 20 Seeking.
21 """ 21 """
22 22
23 import json 23 import json
24 import os 24 import os
25 25
26 from metrics import memory
27 from metrics import v8_object_stats
26 from telemetry import test 28 from telemetry import test
27 from telemetry.core import util 29 from telemetry.core import util
28 from telemetry.page import page_measurement 30 from telemetry.page import page_measurement
29 from telemetry.page import page_set 31 from telemetry.page import page_set
30 32
33 _V8_COUNTER_NAMES = [
34 'V8.OsMemoryAllocated',
35 ]
31 36
32 class _IndexedDbMeasurement(page_measurement.PageMeasurement): 37 class _IndexedDbMeasurement(page_measurement.PageMeasurement):
33 def MeasurePage(self, _, tab, results): 38 def __init__(self, *args, **kwargs):
39 super(_IndexedDbMeasurement, self).__init__(*args, **kwargs)
40 self._memory_metric = None
41 self._v8_object_stats_metric = None
42
43 def DidStartBrowser(self, browser):
44 """Initialize metrics once right after the browser has been launched."""
45 self._memory_metric = memory.MemoryMetric(browser)
46 self._v8_object_stats_metric = \
47 v8_object_stats.V8ObjectStatsMetric(_V8_COUNTER_NAMES)
48
49 def DidNavigateToPage(self, page, tab):
50 self._memory_metric.Start(page, tab)
51 self._v8_object_stats_metric.Start(page, tab)
52
53 def MeasurePage(self, page, tab, results):
34 tab.WaitForDocumentReadyStateToBeComplete() 54 tab.WaitForDocumentReadyStateToBeComplete()
35 tab.WaitForJavaScriptExpression( 55 tab.WaitForJavaScriptExpression(
36 'window.document.cookie.indexOf("__done=1") >= 0', 600) 56 'window.document.cookie.indexOf("__done=1") >= 0', 600)
37 57
58 self._memory_metric.Stop(page, tab)
59 self._v8_object_stats_metric.Stop(page, tab)
60
61 self._memory_metric.AddResults(tab, results)
62 self._v8_object_stats_metric.AddResults(tab, results)
63
38 js_get_results = "JSON.stringify(automation.getResults());" 64 js_get_results = "JSON.stringify(automation.getResults());"
39 result_dict = json.loads(tab.EvaluateJavaScript(js_get_results)) 65 result_dict = json.loads(tab.EvaluateJavaScript(js_get_results))
40 total = 0.0 66 total = 0.0
41 for key in result_dict: 67 for key in result_dict:
42 if key == 'OverallTestDuration': 68 if key == 'OverallTestDuration':
43 continue 69 continue
44 msec = float(result_dict[key]) 70 msec = float(result_dict[key])
45 results.Add(key, 'ms', msec, data_type='unimportant') 71 results.Add(key, 'ms', msec, data_type='unimportant')
46 total += msec 72 total += msec
47 results.Add('Total', 'ms', total) 73 results.Add('Total Perf', 'ms', total)
74
75 def CustomizeBrowserOptions(self, options):
76 memory.MemoryMetric.CustomizeBrowserOptions(options)
77 v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options)
48 78
49 class IndexedDb(test.Test): 79 class IndexedDb(test.Test):
50 """Chromium's IndexedDB Performance tests.""" 80 """Chromium's IndexedDB Performance tests."""
51 test = _IndexedDbMeasurement 81 test = _IndexedDbMeasurement
52 82
53 def CreatePageSet(self, options): 83 def CreatePageSet(self, options):
54 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', 84 indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test',
55 'data', 'indexeddb') 85 'data', 'indexeddb')
56 return page_set.PageSet.FromDict({ 86 return page_set.PageSet.FromDict({
57 'pages': [ 87 'pages': [
58 { 'url': 'file://perf_test.html' } 88 { 'url': 'file://perf_test.html' }
59 ] 89 ]
60 }, indexeddb_dir) 90 }, indexeddb_dir)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698