OLD | NEW |
1 #! /usr/bin/python2 | 1 #! /usr/bin/python2 |
2 # | 2 # |
3 # Copyright 2016 the V8 project authors. All rights reserved. | 3 # Copyright 2016 the V8 project authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 | 7 |
8 import argparse | 8 import argparse |
9 import collections | 9 import collections |
10 import re | 10 import re |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 yield current_chain | 90 yield current_chain |
91 # Reset parser status. | 91 # Reset parser status. |
92 current_chain = [] | 92 current_chain = [] |
93 skip_until_end_of_chain = False | 93 skip_until_end_of_chain = False |
94 compiler_symbol_in_chain = False | 94 compiler_symbol_in_chain = False |
95 continue | 95 continue |
96 | 96 |
97 if skip_until_end_of_chain: | 97 if skip_until_end_of_chain: |
98 continue | 98 continue |
99 | 99 |
100 symbol = line.split(" ", 1)[1] | 100 # Trim the leading address and the trailing +offset, if present. |
| 101 symbol = line.split(" ", 1)[1].split("+", 1)[0] |
101 if not show_full_signatures: | 102 if not show_full_signatures: |
102 symbol = strip_function_parameters(symbol) | 103 symbol = strip_function_parameters(symbol) |
103 current_chain.append(symbol) | 104 current_chain.append(symbol) |
104 | 105 |
105 if symbol.startswith("BytecodeHandler:"): | 106 if symbol.startswith("BytecodeHandler:"): |
106 yield current_chain | 107 yield current_chain |
107 skip_until_end_of_chain = True | 108 skip_until_end_of_chain = True |
108 elif symbol == "Stub:CEntryStub" and compiler_symbol_in_chain: | 109 elif symbol == "Stub:CEntryStub" and compiler_symbol_in_chain: |
109 if show_all: | 110 if show_all: |
110 current_chain[-1] = "[compiler]" | 111 current_chain[-1] = "[compiler]" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 metavar="<output filename>", | 198 metavar="<output filename>", |
198 dest="output_stream" | 199 dest="output_stream" |
199 ) | 200 ) |
200 | 201 |
201 return command_line_parser.parse_args() | 202 return command_line_parser.parse_args() |
202 | 203 |
203 | 204 |
204 def main(): | 205 def main(): |
205 program_options = parse_command_line() | 206 program_options = parse_command_line() |
206 | 207 |
207 perf = subprocess.Popen(["perf", "script", "-f", "ip,sym", | 208 perf = subprocess.Popen(["perf", "script", "--fields", "ip,sym", |
208 "-i", program_options.perf_filename], | 209 "-i", program_options.perf_filename], |
209 stdout=subprocess.PIPE) | 210 stdout=subprocess.PIPE) |
210 | 211 |
211 callchains = collapsed_callchains_generator( | 212 callchains = collapsed_callchains_generator( |
212 perf.stdout, program_options.show_all, | 213 perf.stdout, program_options.show_all, |
213 program_options.show_full_signatures) | 214 program_options.show_full_signatures) |
214 | 215 |
215 if program_options.output_flamegraph: | 216 if program_options.output_flamegraph: |
216 write_flamegraph_input_file(program_options.output_stream, callchains) | 217 write_flamegraph_input_file(program_options.output_stream, callchains) |
217 else: | 218 else: |
218 write_handlers_report(program_options.output_stream, callchains) | 219 write_handlers_report(program_options.output_stream, callchains) |
219 | 220 |
220 | 221 |
221 if __name__ == "__main__": | 222 if __name__ == "__main__": |
222 main() | 223 main() |
OLD | NEW |