def test_collapsed_callchains_generator(self): perf_stream = StringIO.StringIO(PERF_SCRIPT_OUTPUT) callchains = list(ipr.collapsed_callchains_generator(perf_stream)) self.assertListEqual(callchains, [ ["foo", "BytecodeHandler:bar"], ["foo", "BytecodeHandler:bar"], ["beep", "BytecodeHandler:bar"], ["[entry trampoline]"], ])
def test_collapsed_callchains_generator(self): perf_stream = StringIO.StringIO(PERF_SCRIPT_OUTPUT) callchains = list(ipr.collapsed_callchains_generator(perf_stream)) self.assertListEqual(callchains, [ ["foo", "BytecodeHandler:bar"], ["foo", "BytecodeHandler:bar"], ["beep", "BytecodeHandler:bar"], ["[entry trampoline]"], ])
def test_collapsed_callchains_generator_show_other(self): perf_stream = StringIO.StringIO(PERF_SCRIPT_OUTPUT) callchains = list(ipr.collapsed_callchains_generator(perf_stream, show_all=True)) self.assertListEqual(callchains, [ ['firstSymbol', 'secondSymbol', '[other]'], ["foo", "BytecodeHandler:bar"], ["foo", "BytecodeHandler:bar"], ["beep", "BytecodeHandler:bar"], ["hello", "v8::internal::Compiler", "[compiler]"], ["Lost", "[misattributed]"], ["[entry trampoline]"], ])
def test_multiple_handlers(self): perf_stream = StringIO.StringIO(""" 0000 foo(bar) 1234 BytecodeHandler:first 5678 a::random::call<to>(something, else) 9abc BytecodeHandler:second def0 otherIrrelevant(stuff) 1111 entrypoint """) callchains = list(ipr.collapsed_callchains_generator(perf_stream, False)) self.assertListEqual(callchains, [ ["foo", "BytecodeHandler:first"], ])
def test_collapsed_callchains_generator_show_other(self): perf_stream = StringIO.StringIO(PERF_SCRIPT_OUTPUT) callchains = list( ipr.collapsed_callchains_generator(perf_stream, show_all=True)) self.assertListEqual(callchains, [ ['firstSymbol', 'secondSymbol', '[other]'], ["foo", "BytecodeHandler:bar"], ["foo", "BytecodeHandler:bar"], ["beep", "BytecodeHandler:bar"], ["hello", "v8::internal::Compiler", "[compiler]"], ["Lost", "[misattributed]"], ["[entry trampoline]"], ])
def test_collapsed_callchains_generator_hide_other(self): perf_stream = StringIO.StringIO(PERF_SCRIPT_OUTPUT) callchains = list(ipr.collapsed_callchains_generator(perf_stream, hide_other=True, hide_compiler=True, hide_jit=True)) self.assertListEqual(callchains, [ ["foo", "BytecodeHandler:bar", "[interpreter]"], ["foo", "BytecodeHandler:bar", "[interpreter]"], ["beep", "BytecodeHandler:bar", "[interpreter]"], ["Lost", "[misattributed]"], ["[entry trampoline]"], ])
def test_multiple_handlers(self): perf_stream = StringIO.StringIO(""" 0000 foo(bar) 1234 BytecodeHandler:first 5678 a::random::call<to>(something, else) 9abc BytecodeHandler:second def0 otherIrrelevant(stuff) 1111 entrypoint """) callchains = list( ipr.collapsed_callchains_generator(perf_stream, False)) self.assertListEqual(callchains, [ ["foo", "BytecodeHandler:first"], ])
def test_collapsed_callchains_generator_hide_other(self): perf_stream = StringIO.StringIO(PERF_SCRIPT_OUTPUT) callchains = list( ipr.collapsed_callchains_generator(perf_stream, hide_other=True, hide_compiler=True, hide_jit=True)) self.assertListEqual(callchains, [ ["foo", "BytecodeHandler:bar", "[interpreter]"], ["foo", "BytecodeHandler:bar", "[interpreter]"], ["beep", "BytecodeHandler:bar", "[interpreter]"], ["Lost", "[misattributed]"], ["[entry trampoline]"], ])