Chromium Code Reviews| 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)) |