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

Side by Side Diff: tools/perf/perf_tools/memory_benchmark.py

Issue 11273081: Adding a test for measuring memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split out interactions. Created 8 years, 1 month 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/perf_tools/multipage_benchmark_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import copy
5
6 from chrome_remote_control import interaction
7 from chrome_remote_control import multi_page_benchmark
8 from chrome_remote_control import test_helper_interaction #pylint: disable=W0611
9
10 MEMORY_HISTOGRAMS = [
11 {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'},
12 {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb'},
13 {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb'}]
14
15 class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark):
16 def __init__(self):
17 super(MemoryBenchmark, self).__init__()
18 self._interactions = []
19 self._results = {}
20
21 @staticmethod
22 def GetMemoryHistograms(tab, results):
23 for histogram in MEMORY_HISTOGRAMS:
24 name = histogram['name']
25 data = tab.runtime.Evaluate(
26 'window.domAutomationController.getHistogram("%s")' % name)
27 results.Add(name, histogram['units'], data, data_type='histogram')
28
29 def CustomizeBrowserOptions(self, options):
30 options.extra_browser_args.append('--dom-automation')
nduca 2012/11/08 22:05:45 is this flag considered to be long-term supported?
marja 2012/11/09 14:17:35 The --dom-automation command line switch is ultima
31
32 def DoNextInteraction(self, page, tab):
nduca 2012/11/06 05:10:02 I'd like to see interactions be part of the multi_
marja 2012/11/09 14:17:35 Now that we have compound interactions, running th
33 if not self._interactions:
34 return False
35 data = self._interactions[0]
36 self._interactions = self._interactions[1:]
37 i = interaction.FindClassWithName('TestHelper')(data)
38 i.PerformInteraction(page, tab, self)
39 return True
40
41 def DidPerformInteraction(self, _, page, tab):
42 if not self.DoNextInteraction(page, tab):
43 self.GetMemoryHistograms(tab, self._results)
44
45 def MeasurePage(self, page, tab, results):
46 self._interactions = copy.copy(page.interactions)
47 self._results = results
48 tab.WaitForDocumentReadyStateToBeComplete()
49 self.DoNextInteraction(page, tab)
OLDNEW
« no previous file with comments | « no previous file | tools/perf/perf_tools/multipage_benchmark_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698