diff options
author | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-21 14:08:20 +0000 |
---|---|---|
committer | dmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-21 14:08:20 +0000 |
commit | 94010bef9e01753fe6188b7417632badafdca935 (patch) | |
tree | a556a8d2b6bffb1c2335d3bee1f8dd21cba27833 /tools/deep_memory_profiler | |
parent | b40eb213bdf401140b653372b797aaa1cb747ca8 (diff) | |
download | chromium_src-94010bef9e01753fe6188b7417632badafdca935.zip chromium_src-94010bef9e01753fe6188b7417632badafdca935.tar.gz chromium_src-94010bef9e01753fe6188b7417632badafdca935.tar.bz2 |
Change dmprof not to fail when a bucket doesn't match any rule.
It also changes some messages from dmprof.
BUG=259206
NOTRY=True
Review URL: https://chromiumcodereview.appspot.com/23370002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/deep_memory_profiler')
-rw-r--r-- | tools/deep_memory_profiler/lib/sorter.py | 35 | ||||
-rw-r--r-- | tools/deep_memory_profiler/subcommands/cat.py | 5 |
2 files changed, 24 insertions, 16 deletions
diff --git a/tools/deep_memory_profiler/lib/sorter.py b/tools/deep_memory_profiler/lib/sorter.py index 64e0851..baa8d39 100644 --- a/tools/deep_memory_profiler/lib/sorter.py +++ b/tools/deep_memory_profiler/lib/sorter.py @@ -193,7 +193,7 @@ class VMRule(AbstractRule): def __repr__(self): result = cStringIO.StringIO() - result.write('{"%s"=>' % self._name) + result.write('%s: ' % self._name) attributes = [] attributes.append('mmap: %s' % self._mmap) if self._backtrace_function: @@ -206,7 +206,7 @@ class VMRule(AbstractRule): if self._mapped_permission: attributes.append('mapped_permission: "%s"' % self._mapped_permission.pattern) - result.write('%s}' % ', '.join(attributes)) + result.write('{ %s }' % ', '.join(attributes)) return result.getvalue() def match(self, unit): @@ -287,13 +287,14 @@ class MallocRule(AbstractRule): def __repr__(self): result = cStringIO.StringIO() - result.write('{"%s"=>' % self._name) + result.write('%s: ' % self._name) attributes = [] if self._backtrace_function: - attributes.append('backtrace_function: "%s"' % self._backtrace_function) + attributes.append('backtrace_function: "%s"' % + self._backtrace_function.pattern) if self._typeinfo: - attributes.append('typeinfo: "%s"' % self._typeinfo) - result.write('%s}' % ', '.join(attributes)) + attributes.append('typeinfo: "%s"' % self._typeinfo.pattern) + result.write('{ %s }' % ', '.join(attributes)) return result.getvalue() def match(self, unit): @@ -344,11 +345,13 @@ class AbstractSorter(object): def __repr__(self): result = cStringIO.StringIO() - result.write('world=%s' % self._world) - result.write('order=%s' % self._order) - result.write('rules:') + print >> result, '%s' % self._name + print >> result, 'world=%s' % self._world + print >> result, 'name=%s' % self._name + print >> result, 'order=%s' % self._order + print >> result, 'rules:' for rule in self._rules: - result.write(' %s' % rule) + print >> result, ' %s' % rule return result.getvalue() @staticmethod @@ -396,7 +399,7 @@ class VMSorter(AbstractSorter): for rule in self._rules: if rule.match(unit): return rule - assert False + return None class MallocSorter(AbstractSorter): @@ -411,14 +414,12 @@ class MallocSorter(AbstractSorter): return self._no_bucket_rule assert unit.bucket.allocator_type == 'malloc' - if unit.bucket.component_cache: - return unit.bucket.component_cache + # TODO(dmikurube): Utilize component_cache again, or remove it. for rule in self._rules: if rule.match(unit): - unit.bucket.component_cache = rule return rule - assert False + return None class SorterTemplates(object): @@ -453,7 +454,9 @@ class SorterSet(object): def __repr__(self): result = cStringIO.StringIO() - result.write(self._sorters) + for world, sorters in self._sorters.iteritems(): + for sorter in sorters: + print >> result, '%s: %s' % (world, sorter) return result.getvalue() def __iter__(self): diff --git a/tools/deep_memory_profiler/subcommands/cat.py b/tools/deep_memory_profiler/subcommands/cat.py index 1e9e5b3..e80ee6b 100644 --- a/tools/deep_memory_profiler/subcommands/cat.py +++ b/tools/deep_memory_profiler/subcommands/cat.py @@ -59,6 +59,7 @@ class CatCommand(SubCommand): json_root['snapshots'] = [] for dump in dumps: + LOGGER.info('Sorting a dump %s...' % dump.path) json_root['snapshots'].append( self._fill_snapshot(dump, bucket_set, sorters)) @@ -107,9 +108,13 @@ class CatCommand(SubCommand): # Iterate for { vm | malloc } sorters. root['breakdown'] = OrderedDict() for sorter in sorters.iter_world(world): + LOGGER.info(' Sorting with %s:%s.' % (sorter.world, sorter.name)) breakdown = OrderedDict() 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 |