Refactor dmprof: remove no_dump flag for 'buckets' in load_basic_files.

It's the third step to accept Android's heap profiler discussed in http://crbug.com/382489.

BUG=391212
NOTRY=True

Review URL: https://codereview.chromium.org/467563002

Cr-Commit-Position: refs/heads/master@{#289255}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289255 0039d316-1c4b-4281-b951-d872f2087c98
parent 9648b65b
...@@ -31,8 +31,7 @@ class SubCommand(object): ...@@ -31,8 +31,7 @@ class SubCommand(object):
self._parser = optparse.OptionParser(usage) self._parser = optparse.OptionParser(usage)
@staticmethod @staticmethod
def load_basic_files( def load_basic_files(dump_path, multiple, alternative_dirs=None):
dump_path, multiple, no_dump=False, alternative_dirs=None):
prefix = SubCommand._find_prefix(dump_path) prefix = SubCommand._find_prefix(dump_path)
# If the target process is estimated to be working on Android, converts # If the target process is estimated to be working on Android, converts
# a path in the Android device to a path estimated to be corresponding in # a path in the Android device to a path estimated to be corresponding in
...@@ -46,11 +45,10 @@ class SubCommand(object): ...@@ -46,11 +45,10 @@ class SubCommand(object):
symbol_data_sources.prepare() symbol_data_sources.prepare()
bucket_set = BucketSet() bucket_set = BucketSet()
bucket_set.load(prefix) bucket_set.load(prefix)
if not no_dump: if multiple:
if multiple: dump_list = DumpList.load(SubCommand._find_all_dumps(dump_path))
dump_list = DumpList.load(SubCommand._find_all_dumps(dump_path)) else:
else: dump = Dump.load(dump_path)
dump = Dump.load(dump_path)
symbol_mapping_cache = SymbolMappingCache() symbol_mapping_cache = SymbolMappingCache()
with open(prefix + '.cache.function', 'a+') as cache_f: with open(prefix + '.cache.function', 'a+') as cache_f:
symbol_mapping_cache.update( symbol_mapping_cache.update(
...@@ -65,9 +63,7 @@ class SubCommand(object): ...@@ -65,9 +63,7 @@ class SubCommand(object):
SOURCEFILE_SYMBOLS, bucket_set, SOURCEFILE_SYMBOLS, bucket_set,
SymbolFinder(SOURCEFILE_SYMBOLS, symbol_data_sources), cache_f) SymbolFinder(SOURCEFILE_SYMBOLS, symbol_data_sources), cache_f)
bucket_set.symbolize(symbol_mapping_cache) bucket_set.symbolize(symbol_mapping_cache)
if no_dump: if multiple:
return bucket_set
elif multiple:
return (bucket_set, dump_list) return (bucket_set, dump_list)
else: else:
return (bucket_set, dump) return (bucket_set, dump)
......
...@@ -18,7 +18,7 @@ class BucketsCommand(SubCommand): ...@@ -18,7 +18,7 @@ class BucketsCommand(SubCommand):
def do(self, sys_argv, out=sys.stdout): def do(self, sys_argv, out=sys.stdout):
_, args = self._parse_args(sys_argv, 1) _, args = self._parse_args(sys_argv, 1)
dump_path = args[1] dump_path = args[1]
bucket_set = SubCommand.load_basic_files(dump_path, True, True) (bucket_set, _) = SubCommand.load_basic_files(dump_path, True)
BucketsCommand._output(bucket_set, out) BucketsCommand._output(bucket_set, out)
return 0 return 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment