Chromium Code Reviews| 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 perf_tools import histogram_metric | 4 from perf_tools import histogram_metric |
| 5 from telemetry.page import page_measurement | 5 from telemetry.page import page_measurement |
| 6 | 6 |
| 7 MEMORY_HISTOGRAMS = [ | 7 MEMORY_HISTOGRAMS = [ |
| 8 {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'}, | 8 {'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'}, |
| 9 {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb'}, | 9 {'name': 'V8.MemoryHeapSampleTotalCommitted', 'units': 'kb'}, |
| 10 {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb'}, | 10 {'name': 'V8.MemoryHeapSampleTotalUsed', 'units': 'kb'}, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 # and no other pages. For this test, we need to disable histogram | 36 # and no other pages. For this test, we need to disable histogram |
| 37 # customizing, so that we get the same generic histograms produced for all | 37 # customizing, so that we get the same generic histograms produced for all |
| 38 # pages. | 38 # pages. |
| 39 options.AppendExtraBrowserArg('--disable-histogram-customizer') | 39 options.AppendExtraBrowserArg('--disable-histogram-customizer') |
| 40 options.AppendExtraBrowserArg('--memory-metrics') | 40 options.AppendExtraBrowserArg('--memory-metrics') |
| 41 options.AppendExtraBrowserArg('--reduce-security-for-dom-automation-tests') | 41 options.AppendExtraBrowserArg('--reduce-security-for-dom-automation-tests') |
| 42 | 42 |
| 43 def CanRunForPage(self, page): | 43 def CanRunForPage(self, page): |
| 44 return hasattr(page, 'stress_memory') | 44 return hasattr(page, 'stress_memory') |
| 45 | 45 |
| 46 def MeasurePage(self, page, tab, results): | 46 def MeasurePage(self, page, tab, results): |
|
Dai Mikurube (NOT FULLTIME)
2013/05/14 15:07:07
Just a question. When is is called?
bulach
2013/05/14 15:34:17
afaict, this is called after all actions for a giv
Dai Mikurube (NOT FULLTIME)
2013/05/14 17:02:10
Got it. Thanks!
| |
| 47 for h in self.histograms: | 47 for h in self.histograms: |
| 48 h.GetValue(page, tab, results) | 48 h.GetValue(page, tab, results) |
| 49 dumps = eval(tab.EvaluateJavaScript(""" | |
| 50 if (chrome && chrome.memoryBenchmarking && | |
| 51 chrome.memoryBenchmarking.isHeapProfilerRunning()) { | |
|
Dai Mikurube (NOT FULLTIME)
2013/05/14 15:07:07
I'm not confident whether we should always dump wh
bulach
2013/05/14 15:34:17
good idea! done.
| |
| 52 JSON.stringify([ | |
| 53 chrome.memoryBenchmarking.heapProfilerDump('renderer'), | |
| 54 chrome.memoryBenchmarking.heapProfilerDump('browser'), | |
| 55 ]); | |
| 56 } else { | |
| 57 JSON.stringify([]); | |
| 58 } | |
| 59 """)) | |
| 60 if dumps: | |
| 61 print 'Memory dumps available at ', dumps | |
| OLD | NEW |