Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: tools/deep_memory_profiler/subcommands/cat.py

Issue 22352005: Add supports for nested breakdown in 'dmprof cat'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/deep_memory_profiler/sorter.vm-sharing.json ('k') | tools/deep_memory_profiler/templates.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/deep_memory_profiler/subcommands/cat.py
diff --git a/tools/deep_memory_profiler/subcommands/cat.py b/tools/deep_memory_profiler/subcommands/cat.py
index b7783b9af9987486685beedb72a957aff83f2d4b..1e9e5b39d8ab7ed794360c9edeb10cd9702b752c 100644
--- a/tools/deep_memory_profiler/subcommands/cat.py
+++ b/tools/deep_memory_profiler/subcommands/cat.py
@@ -37,6 +37,9 @@ class CatCommand(SubCommand):
(bucket_set, dumps) = SubCommand.load_basic_files(
dump_path, True, alternative_dirs=alternative_dirs_dict)
+ # Load all sorters.
+ sorters = SorterSet()
+
json_root = OrderedDict()
json_root['version'] = 1
json_root['run_id'] = None
@@ -46,10 +49,14 @@ class CatCommand(SubCommand):
json_root['run_id'] = ''
break
json_root['run_id'] = dump.run_id
- json_root['snapshots'] = []
+ json_root['roots'] = []
+ for sorter in sorters:
+ if sorter.root:
+ json_root['roots'].append([sorter.world, sorter.name])
+ json_root['default_template'] = 'l2'
+ json_root['templates'] = sorters.templates.as_dict()
- # Load all sorters.
- sorters = SorterSet()
+ json_root['snapshots'] = []
for dump in dumps:
json_root['snapshots'].append(
@@ -76,9 +83,9 @@ class CatCommand(SubCommand):
def _fill_world(dump, bucket_set, sorters, world):
root = OrderedDict()
- root['name'] = 'world'
+ root['name'] = world
if world == 'vm':
- root['unit_fields'] = ['committed', 'reserved']
+ root['unit_fields'] = ['size', 'reserved']
elif world == 'malloc':
root['unit_fields'] = ['size', 'alloc_count', 'free_count']
@@ -107,11 +114,11 @@ class CatCommand(SubCommand):
category = OrderedDict()
category['name'] = found.name
category['color'] = 'random'
- subworlds = {}
- for subworld in found.iter_subworld():
- subworlds[subworld] = False
- if subworlds:
- category['subworlds'] = subworlds
+ 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'] = []
« no previous file with comments | « tools/deep_memory_profiler/sorter.vm-sharing.json ('k') | tools/deep_memory_profiler/templates.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698