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

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

Issue 11975048: Native memory histograms for the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ios build fix Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 from telemetry import multi_page_benchmark 4 from telemetry import multi_page_benchmark
5 5
6 MEMORY_HISTOGRAMS = [ 6 MEMORY_HISTOGRAMS = [
7 {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'}, 7 {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'},
8 {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb'}, 8 {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb'},
9 {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb'}, 9 {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb'},
10 {'name': 'Memory.RendererUsed', 'units': 'kb'}] 10 {'name': 'Memory.RendererUsed', 'units': 'kb'}]
11 11
12 BROWSER_MEMORY_HISTOGRAMS = [
13 {'name': 'Memory.BrowserUsed', 'units': 'kb'}]
14
12 class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark): 15 class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark):
13 def __init__(self): 16 def __init__(self):
14 super(MemoryBenchmark, self).__init__('stress_memory') 17 super(MemoryBenchmark, self).__init__('stress_memory')
15 18
16 def CustomizeBrowserOptions(self, options): 19 def CustomizeBrowserOptions(self, options):
17 options.AppendExtraBrowserArg('--dom-automation') 20 options.AppendExtraBrowserArg('--dom-automation')
18 # For a hard-coded set of Google pages (such as GMail), we produce custom 21 # For a hard-coded set of Google pages (such as GMail), we produce custom
19 # memory histograms (V8.Something_gmail) instead of the generic histograms 22 # memory histograms (V8.Something_gmail) instead of the generic histograms
20 # (V8.Something), if we detect that a renderer is only rendering this page 23 # (V8.Something), if we detect that a renderer is only rendering this page
21 # and no other pages. For this test, we need to disable histogram 24 # and no other pages. For this test, we need to disable histogram
22 # customizing, so that we get the same generic histograms produced for all 25 # customizing, so that we get the same generic histograms produced for all
23 # pages. 26 # pages.
24 options.AppendExtraBrowserArg('--disable-histogram-customizer') 27 options.AppendExtraBrowserArg('--disable-histogram-customizer')
25 options.AppendExtraBrowserArg('--memory-metrics') 28 options.AppendExtraBrowserArg('--memory-metrics')
26 29
27 def CanRunForPage(self, page): 30 def CanRunForPage(self, page):
28 return hasattr(page, 'stress_memory') 31 return hasattr(page, 'stress_memory')
29 32
30 def MeasurePage(self, page, tab, results): 33 def MeasurePage(self, page, tab, results):
31 for histogram in MEMORY_HISTOGRAMS: 34 for histogram in MEMORY_HISTOGRAMS:
32 name = histogram['name'] 35 self._GetHistogramFromDomAutomation(tab, 'getHistogram', histogram,
33 data = tab.EvaluateJavaScript( 36 results)
34 'window.domAutomationController.getHistogram ? ' 37 for histogram in BROWSER_MEMORY_HISTOGRAMS:
35 'window.domAutomationController.getHistogram("%s") : ""' % name) 38 self._GetHistogramFromDomAutomation(tab, 'getBrowserHistogram', histogram,
36 if data: 39 results)
37 results.Add(name.replace('.', '_'), histogram['units'], data, 40
38 data_type='histogram') 41 def _GetHistogramFromDomAutomation(self, tab, func, histogram, results):
42 name = histogram['name']
43 js = ('window.domAutomationController.%s ? '
44 'window.domAutomationController.%s("%s") : ""' % (func, func, name))
45 data = tab.EvaluateJavaScript(js)
46 if data:
47 results.Add(name.replace('.', '_'), histogram['units'], data,
48 data_type='histogram')
OLDNEW
« no previous file with comments | « content/renderer/renderer_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698