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

Unified Diff: build/android/adb_profile_chrome.py

Issue 291723002: Add --trace-memory option for tracing heap memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_profile_chrome.py
diff --git a/build/android/adb_profile_chrome.py b/build/android/adb_profile_chrome.py
index 2e25d9c40779229b1e7e0db57168981e0c4dd2b7..a53d7ead6a43d4dabe296c00d770b5edd5bffea8 100755
--- a/build/android/adb_profile_chrome.py
+++ b/build/android/adb_profile_chrome.py
@@ -31,7 +31,7 @@ sys.path.append(_TRACE_VIEWER_ROOT)
from trace_viewer.build import trace2html # pylint: disable=F0401
_DEFAULT_CHROME_CATEGORIES = '_DEFAULT_CHROME_CATEGORIES'
-
+_HEAP_PROFILE_MMAP_PROPERTY = 'heapprof.mmap'
def _GetTraceTimestamp():
return time.strftime('%Y-%m-%d-%H%M%S', time.localtime())
@@ -309,6 +309,8 @@ def _ComputeChromeCategories(options):
categories.append('disabled-by-default-gpu.debug*')
if options.trace_flow:
categories.append('disabled-by-default-toplevel.flow')
+ if options.trace_memory:
+ categories.append('disabled-by-default-memory')
if options.chrome_categories:
categories += options.chrome_categories.split(',')
return categories
@@ -371,6 +373,9 @@ def main():
'GPU data.', action='store_true')
categories.add_option('--trace-flow', help='Enable extra trace categories '
'for IPC message flows.', action='store_true')
+ categories.add_option('--trace-memory', help='Enable extra trace categories '
+ 'for memory profile. (tcmalloc required)',
+ action='store_true')
parser.add_option_group(categories)
output_options = optparse.OptionGroup(parser, 'Output options')
@@ -435,6 +440,11 @@ When in doubt, just try out --trace-frame-viewer.
_PrintMessage('Time interval or continuous tracing should be specified.')
return 1
+ system_properties = device.old_interface.system_properties
Sami 2014/05/22 15:52:38 Could you please move this bit of code to ChromeTr
+ if options.trace_memory:
+ device.old_interface.EnableAdbRoot()
+ system_properties[_HEAP_PROFILE_MMAP_PROPERTY] = 1
+
chrome_categories = _ComputeChromeCategories(options)
systrace_categories = _ComputeSystraceCategories(options)
@@ -464,6 +474,10 @@ When in doubt, just try out --trace-frame-viewer.
options.output,
options.compress,
options.json)
+
+ if options.trace_memory:
Sami 2014/05/22 15:52:38 ...and this code to ChromeTracingController.StopTr
+ system_properties[_HEAP_PROFILE_MMAP_PROPERTY] = 0
+
if options.view:
if sys.platform == 'darwin':
os.system('/usr/bin/open %s' % os.path.abspath(result))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698