Chromium Code Reviews| Index: tools/ignition/linux_perf_report.py |
| diff --git a/tools/ignition/linux_perf_report.py b/tools/ignition/linux_perf_report.py |
| index eaf85b3f91efd21dd62fa5ba9d78d559a6e3fab6..ee413e0d2cacf5c703d72b6fa1789d20a8a8d436 100755 |
| --- a/tools/ignition/linux_perf_report.py |
| +++ b/tools/ignition/linux_perf_report.py |
| @@ -52,6 +52,8 @@ examples: |
| COMPILER_SYMBOLS_RE = re.compile( |
| r"v8::internal::(?:\(anonymous namespace\)::)?Compile|v8::internal::Parser") |
| +JIT_CODE_SYMBOLS_RE = re.compile( |
| + r"(LazyCompile|Compile|Eval|Script):(\*|~)") |
| def strip_function_parameters(symbol): |
| @@ -70,7 +72,8 @@ def strip_function_parameters(symbol): |
| return symbol[:-pos] |
| -def collapsed_callchains_generator(perf_stream, show_all=False, |
| +def collapsed_callchains_generator(perf_stream, hide_other=False, |
| + hide_compiler=False, hide_jit=False, |
| show_full_signatures=False): |
| current_chain = [] |
| skip_until_end_of_chain = False |
| @@ -85,7 +88,8 @@ def collapsed_callchains_generator(perf_stream, show_all=False, |
| # Empty line signals the end of the callchain. |
| if not line: |
| - if not skip_until_end_of_chain and current_chain and show_all: |
| + if (not skip_until_end_of_chain and current_chain |
| + and not hide_other): |
| current_chain.append("[other]") |
| yield current_chain |
| # Reset parser status. |
| @@ -101,14 +105,25 @@ def collapsed_callchains_generator(perf_stream, show_all=False, |
| symbol = line.split(" ", 1)[1].split("+", 1)[0] |
| if not show_full_signatures: |
| symbol = strip_function_parameters(symbol) |
| + |
| + # Avoid chains of [unknown] |
| + if symbol == "[unknown]" and current_chain[-1] == "[unknown]": |
|
mythria
2016/11/08 09:47:07
It is possible that symbol is unknown and the curr
|
| + continue |
| + |
| current_chain.append(symbol) |
| if symbol.startswith("BytecodeHandler:"): |
| + current_chain.append("[interpreter]") |
| yield current_chain |
| skip_until_end_of_chain = True |
| + elif JIT_CODE_SYMBOLS_RE.match(symbol): |
| + if not hide_jit: |
| + current_chain.append("[jit]") |
| + yield current_chain |
| + skip_until_end_of_chain = True |
| elif symbol == "Stub:CEntryStub" and compiler_symbol_in_chain: |
| - if show_all: |
| - current_chain[-1] = "[compiler]" |
| + if not hide_compiler: |
| + current_chain.append("[compiler]") |
| yield current_chain |
| skip_until_end_of_chain = True |
| elif COMPILER_SYMBOLS_RE.match(symbol): |
| @@ -181,8 +196,18 @@ def parse_command_line(): |
| dest="output_flamegraph" |
| ) |
| command_line_parser.add_argument( |
| - "--show-all", "-a", |
| - help="show samples outside Ignition bytecode handlers", |
| + "--hide-other", |
| + help="Hide other samples", |
| + action="store_true" |
| + ) |
| + command_line_parser.add_argument( |
| + "--hide-compiler", |
| + help="Hide samples during compilation", |
| + action="store_true" |
| + ) |
| + command_line_parser.add_argument( |
| + "--hide-jit", |
| + help="Hide samples from JIT code execution", |
| action="store_true" |
| ) |
| command_line_parser.add_argument( |
| @@ -210,8 +235,8 @@ def main(): |
| stdout=subprocess.PIPE) |
| callchains = collapsed_callchains_generator( |
| - perf.stdout, program_options.show_all, |
| - program_options.show_full_signatures) |
| + perf.stdout, program_options.hide_other, program_options.hide_compiler, |
| + program_options.hide_jit, program_options.show_full_signatures) |
| if program_options.output_flamegraph: |
| write_flamegraph_input_file(program_options.output_stream, callchains) |