Commit 065e7605 authored by nednguyen's avatar nednguyen Committed by Commit bot

Move heap profile dumping logic from memory measurement to tcmalloc_heap_profiler.

BUG=

Review URL: https://codereview.chromium.org/543803004

Cr-Commit-Position: refs/heads/master@{#293411}
parent 88d8e4e3
......@@ -33,15 +33,3 @@ class Memory(page_test.PageTest):
self._memory_metric.Stop(page, tab)
self._memory_metric.AddResults(tab, results)
self._power_metric.AddResults(tab, results)
if tab.browser.is_profiler_active('tcmalloc-heap'):
# The tcmalloc_heap_profiler dumps files at regular
# intervals (~20 secs).
# This is a minor optimization to ensure it'll dump the last file when
# the test completes.
tab.ExecuteJavaScript("""
if (chrome && chrome.memoryBenchmarking) {
chrome.memoryBenchmarking.heapProfilerDump('renderer', 'final');
chrome.memoryBenchmarking.heapProfilerDump('browser', 'final');
}
""")
......@@ -122,5 +122,19 @@ class TCMallocHeapProfiler(profiler.Profiler):
options.AppendExtraBrowserArgs('--no-sandbox')
options.AppendExtraBrowserArgs('--enable-memory-benchmarking')
@classmethod
def WillCloseBrowser(cls, browser_backend, platform_backend):
# The tcmalloc_heap_profiler dumps files at regular
# intervals (~20 secs).
# This is a minor optimization to ensure it'll dump the last file when
# the test completes.
for i in xrange(len(browser_backend.browser.tabs)):
browser_backend.browser.tabs[i].ExecuteJavaScript("""
if (chrome && chrome.memoryBenchmarking) {
chrome.memoryBenchmarking.heapProfilerDump('renderer', 'final');
chrome.memoryBenchmarking.heapProfilerDump('browser', 'final');
}
""")
def CollectProfile(self):
return self._platform_profiler.CollectProfile()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment