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

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

Issue 19346002: Refactor dmprof: Split dmprof.py into modules. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/subcommands/__init__.py ('k') | tools/deep_memory_profiler/subcommands/cat.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/deep_memory_profiler/subcommands/buckets.py
diff --git a/tools/deep_memory_profiler/subcommands/buckets.py b/tools/deep_memory_profiler/subcommands/buckets.py
new file mode 100644
index 0000000000000000000000000000000000000000..4ea8640ca9d574f0def030bcc645073f126a9b96
--- /dev/null
+++ b/tools/deep_memory_profiler/subcommands/buckets.py
@@ -0,0 +1,35 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import logging
+import sys
+
+from lib.subcommand import SubCommand
+
+
+LOGGER = logging.getLogger('dmprof')
+
+
+class BucketsCommand(SubCommand):
+ def __init__(self):
+ super(BucketsCommand, self).__init__('Usage: %prog buckets <first-dump>')
+
+ def do(self, sys_argv, out=sys.stdout):
+ _, args = self._parse_args(sys_argv, 1)
+ dump_path = args[1]
+ bucket_set = SubCommand.load_basic_files(dump_path, True, True)
+
+ BucketsCommand._output(bucket_set, out)
+ return 0
+
+ @staticmethod
+ def _output(bucket_set, out):
+ """Prints all buckets with resolving symbols.
+
+ Args:
+ bucket_set: A BucketSet object.
+ out: An IO object to output.
+ """
+ for bucket_id, bucket in sorted(bucket_set):
+ out.write('%d: %s\n' % (bucket_id, bucket))
« no previous file with comments | « tools/deep_memory_profiler/subcommands/__init__.py ('k') | tools/deep_memory_profiler/subcommands/cat.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698