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

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..fdbed3b69ff5027880f1b77f019068f9cebaf3c7 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 = 'heapprof.mmap'
Sami 2014/05/19 16:00:10 nit: could you call this _HEAP_PROFILE_MMAP_PROPER
JungJik 2014/05/19 16:35:36 sure!
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,14 @@ 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
+ if options.trace_memory:
+ if not device.old_interface.IsRootEnabled():
+ device.old_interface.EnableAdbRoot()
Sami 2014/05/19 16:00:10 You can just call EnableAdbRoot() unconditionally
JungJik 2014/05/19 16:35:36 thanks for your comment.
+ system_properties[_HEAP_PROFILE_MMAP] = 1
+ else:
+ system_properties[_HEAP_PROFILE_MMAP] = 0
Sami 2014/05/19 11:39:49 Should we reset this property after tracing? Are t
JungJik 2014/05/19 12:08:10 Thanks for your comment. I've just checked the co
Sami 2014/05/19 16:00:10 Thanks for checking. I was thinking more about the
JungJik 2014/05/19 16:35:36 how about reset after pulling the trace file, then
+
chrome_categories = _ComputeChromeCategories(options)
systrace_categories = _ComputeSystraceCategories(options)
« 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