diff options
author | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-21 14:31:48 +0000 |
---|---|---|
committer | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-21 14:31:48 +0000 |
commit | e348e332ae121a6d15fef464b931c709b580884f (patch) | |
tree | 294a8c899ba41bace67aba109e4a3710f838ff42 /tools/deep_memory_profiler/subcommands | |
parent | 8e4f8127cb4c073be46547249e16830ba96b405d (diff) | |
download | chromium_src-e348e332ae121a6d15fef464b931c709b580884f.zip chromium_src-e348e332ae121a6d15fef464b931c709b580884f.tar.gz chromium_src-e348e332ae121a6d15fef464b931c709b580884f.tar.bz2 |
Make 'dmprof cat' to dump 'orders' of rules and units for all rules even if empty.
It also removes "no-buckets" from 'dmprof cat'.
BUG=259206
NOTRY=True
Review URL: https://chromiumcodereview.appspot.com/22854031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/deep_memory_profiler/subcommands')
-rw-r--r-- | tools/deep_memory_profiler/subcommands/cat.py | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/tools/deep_memory_profiler/subcommands/cat.py b/tools/deep_memory_profiler/subcommands/cat.py index e80ee6b..6a333a4 100644 --- a/tools/deep_memory_profiler/subcommands/cat.py +++ b/tools/deep_memory_profiler/subcommands/cat.py @@ -56,6 +56,19 @@ class CatCommand(SubCommand): json_root['default_template'] = 'l2' json_root['templates'] = sorters.templates.as_dict() + orders = OrderedDict() + orders['worlds'] = OrderedDict() + for world in ['vm', 'malloc']: + orders['worlds'][world] = OrderedDict() + orders['worlds'][world]['breakdown'] = OrderedDict() + for sorter in sorters.iter_world(world): + order = [] + for rule in sorter.iter_rule(): + if (not order) or (rule.name != order[-1]): + order.append(rule.name) + orders['worlds'][world]['breakdown'][sorter.name] = order + json_root['orders'] = orders + json_root['snapshots'] = [] for dump in dumps: @@ -110,25 +123,23 @@ class CatCommand(SubCommand): for sorter in sorters.iter_world(world): LOGGER.info(' Sorting with %s:%s.' % (sorter.world, sorter.name)) breakdown = OrderedDict() + for rule in sorter.iter_rule(): + category = OrderedDict() + category['name'] = rule.name + subs = [] + for sub_world, sub_breakdown in rule.iter_subs(): + subs.append([sub_world, sub_breakdown]) + if subs: + category['subs'] = subs + if rule.hidden: + category['hidden'] = True + category['units'] = [] + breakdown[rule.name] = category for unit in unit_set: found = sorter.find(unit) - if not found: - # A bucket which doesn't match any rule is just dropped. - continue - if found.name not in breakdown: - category = OrderedDict() - category['name'] = found.name - category['color'] = 'random' - subs = [] - for sub_world, sub_breakdown in found.iter_subs(): - subs.append([sub_world, sub_breakdown]) - if subs: - category['subs'] = subs - if found.hidden: - category['hidden'] = True - category['units'] = [] - breakdown[found.name] = category - breakdown[found.name]['units'].append(unit.unit_id) + if found: + # Note that a bucket which doesn't match any rule is just dropped. + breakdown[found.name]['units'].append(unit.unit_id) root['breakdown'][sorter.name] = breakdown return root |