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

Side by Side Diff: tools/deep_memory_profiler/subcommands/stacktrace.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 import sys
6
7 from lib.bucket import BUCKET_ID
8 from lib.subcommand import SubCommand
9
10
11 class StacktraceCommand(SubCommand):
12 def __init__(self):
13 super(StacktraceCommand, self).__init__(
14 'Usage: %prog stacktrace <dump>')
15
16 def do(self, sys_argv):
17 _, args = self._parse_args(sys_argv, 1)
18 dump_path = args[1]
19 (bucket_set, dump) = SubCommand.load_basic_files(dump_path, False)
20
21 StacktraceCommand._output(dump, bucket_set, sys.stdout)
22 return 0
23
24 @staticmethod
25 def _output(dump, bucket_set, out):
26 """Outputs a given stacktrace.
27
28 Args:
29 bucket_set: A BucketSet object.
30 out: A file object to output.
31 """
32 for line in dump.iter_stacktrace:
33 words = line.split()
34 bucket = bucket_set.get(int(words[BUCKET_ID]))
35 if not bucket:
36 continue
37 for i in range(0, BUCKET_ID - 1):
38 out.write(words[i] + ' ')
39 for frame in bucket.symbolized_stackfunction:
40 out.write(frame + ' ')
41 out.write('\n')
OLDNEW
« no previous file with comments | « tools/deep_memory_profiler/subcommands/pprof.py ('k') | tools/deep_memory_profiler/subcommands/upload.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698