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) |