Revert "Always activate MojoApplicationHost"
[chromium-blink-merge.git] / tools / deep_memory_profiler / subcommands / buckets.py
blobc5b65560a8f82c01534d3382d19ef7408af994ab
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import logging
6 import sys
8 from lib.subcommand import SubCommand
11 LOGGER = logging.getLogger('dmprof')
14 class BucketsCommand(SubCommand):
15 def __init__(self):
16 super(BucketsCommand, self).__init__('Usage: %prog buckets <first-dump>')
18 def do(self, sys_argv, out=sys.stdout):
19 _, args = self._parse_args(sys_argv, 1)
20 dump_path = args[1]
21 (bucket_set, _) = SubCommand.load_basic_files(dump_path, True)
23 BucketsCommand._output(bucket_set, out)
24 return 0
26 @staticmethod
27 def _output(bucket_set, out):
28 """Prints all buckets with resolving symbols.
30 Args:
31 bucket_set: A BucketSet object.
32 out: An IO object to output.
33 """
34 for bucket_id, bucket in sorted(bucket_set):
35 out.write('%d: %s\n' % (bucket_id, bucket))