OLD | NEW |
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 | 11 |
11 class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark): | 12 class MemoryBenchmark(multi_page_benchmark.MultiPageBenchmark): |
12 def __init__(self): | 13 def __init__(self): |
13 super(MemoryBenchmark, self).__init__('stress_memory') | 14 super(MemoryBenchmark, self).__init__('stress_memory') |
14 | 15 |
15 def CustomizeBrowserOptions(self, options): | 16 def CustomizeBrowserOptions(self, options): |
16 options.AppendExtraBrowserArg('--dom-automation') | 17 options.AppendExtraBrowserArg('--dom-automation') |
17 # For a hard-coded set of Google pages (such as GMail), we produce custom | 18 # For a hard-coded set of Google pages (such as GMail), we produce custom |
18 # memory histograms (V8.Something_gmail) instead of the generic histograms | 19 # memory histograms (V8.Something_gmail) instead of the generic histograms |
19 # (V8.Something), if we detect that a renderer is only rendering this page | 20 # (V8.Something), if we detect that a renderer is only rendering this page |
20 # and no other pages. For this test, we need to disable histogram | 21 # and no other pages. For this test, we need to disable histogram |
21 # customizing, so that we get the same generic histograms produced for all | 22 # customizing, so that we get the same generic histograms produced for all |
22 # pages. | 23 # pages. |
23 options.AppendExtraBrowserArg('--disable-histogram-customizer') | 24 options.AppendExtraBrowserArg('--disable-histogram-customizer') |
| 25 options.AppendExtraBrowserArg('--memory-metrics') |
24 | 26 |
25 def CanRunForPage(self, page): | 27 def CanRunForPage(self, page): |
26 return hasattr(page, 'stress_memory') | 28 return hasattr(page, 'stress_memory') |
27 | 29 |
28 def MeasurePage(self, page, tab, results): | 30 def MeasurePage(self, page, tab, results): |
29 for histogram in MEMORY_HISTOGRAMS: | 31 for histogram in MEMORY_HISTOGRAMS: |
30 name = histogram['name'] | 32 name = histogram['name'] |
31 data = tab.runtime.Evaluate( | 33 data = tab.runtime.Evaluate( |
32 'window.domAutomationController.getHistogram ? ' | 34 'window.domAutomationController.getHistogram ? ' |
33 'window.domAutomationController.getHistogram("%s") : ""' % name) | 35 'window.domAutomationController.getHistogram("%s") : ""' % name) |
34 if data: | 36 if data: |
35 results.Add(name.replace('.', '_'), histogram['units'], data, | 37 results.Add(name.replace('.', '_'), histogram['units'], data, |
36 data_type='histogram') | 38 data_type='histogram') |
OLD | NEW |