diff options
author | descri@yandex-team.ru <descri@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-23 13:17:11 +0000 |
---|---|---|
committer | descri@yandex-team.ru <descri@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-23 13:17:11 +0000 |
commit | 3d894887b7895c9d67f875ae990889a0b50af4a3 (patch) | |
tree | 8a7d8e39d901698af40beedcab4fb55373a1ef77 | |
parent | 6916ca2c723634a906a2dc9c84913e10d608b143 (diff) | |
download | chromium_src-3d894887b7895c9d67f875ae990889a0b50af4a3.zip chromium_src-3d894887b7895c9d67f875ae990889a0b50af4a3.tar.gz chromium_src-3d894887b7895c9d67f875ae990889a0b50af4a3.tar.bz2 |
Added support for using Deep Memory Profiler with Android builds.
TEST=dmprof expand --alternative-dirs should work now.
Invalid component name should not fail silently.
Review URL: https://codereview.chromium.org/139403005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246582 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | tools/deep_memory_profiler/subcommands/expand.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/deep_memory_profiler/subcommands/expand.py b/tools/deep_memory_profiler/subcommands/expand.py index 4058a00..b2b2c01 100644 --- a/tools/deep_memory_profiler/subcommands/expand.py +++ b/tools/deep_memory_profiler/subcommands/expand.py @@ -17,15 +17,31 @@ class ExpandCommand(SubCommand): def __init__(self): super(ExpandCommand, self).__init__( 'Usage: %prog expand <dump> <policy> <component> <depth>') + self._parser.add_option('--alternative-dirs', dest='alternative_dirs', + metavar='/path/on/target@/path/on/host[:...]', + help='Read files in /path/on/host/ instead of ' + 'files in /path/on/target/.') def do(self, sys_argv): - _, args = self._parse_args(sys_argv, 4) + options, args = self._parse_args(sys_argv, 4) dump_path = args[1] target_policy = args[2] component_name = args[3] depth = args[4] - (bucket_set, dump) = SubCommand.load_basic_files(dump_path, False) + alternative_dirs_dict = {} + policy_set = PolicySet.load(SubCommand._parse_policy_list(target_policy)) + if not policy_set[target_policy].find_rule(component_name): + sys.stderr.write("ERROR: Component %s not found in policy %s\n" + % (component_name, target_policy)) + return 1 + + if options.alternative_dirs: + for alternative_dir_pair in options.alternative_dirs.split(':'): + target_path, host_path = alternative_dir_pair.split('@', 1) + alternative_dirs_dict[target_path] = host_path + (bucket_set, dump) = SubCommand.load_basic_files( + dump_path, False, alternative_dirs=alternative_dirs_dict) ExpandCommand._output(dump, policy_set[target_policy], bucket_set, component_name, int(depth), sys.stdout) |