From a4006e19d7a7ebb5f600c958809cb3ba1580b63c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 11 Apr 2020 20:40:16 +0200 Subject: [PATCH] ProfileViewer: Don't skip the innermost frame when loading profiles We were skipping the innermost frame as a workaround for the kernel putting garbage data there. Now that the kernel puts the instruction poiner there, we can load the frame normally! :^) --- DevTools/ProfileViewer/Profile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DevTools/ProfileViewer/Profile.cpp b/DevTools/ProfileViewer/Profile.cpp index 93bddfa16c..d9a6c444f0 100644 --- a/DevTools/ProfileViewer/Profile.cpp +++ b/DevTools/ProfileViewer/Profile.cpp @@ -144,10 +144,11 @@ void Profile::rebuild_tree() else node = &node->find_or_create_child(symbol, address, offset, event.timestamp); - node->add_event_address(address); node->increment_event_count(); - if (is_innermost_frame) + if (is_innermost_frame) { + node->add_event_address(address); node->increment_self_count(); + } return IterationDecision::Continue; }); @@ -217,7 +218,7 @@ OwnPtr Profile::load_from_perfcore_file(const StringView& path) } auto stack_array = perf_event.get("stack").as_array(); - for (ssize_t i = stack_array.values().size() - 1; i >= 1; --i) { + for (ssize_t i = stack_array.values().size() - 1; i >= 0; --i) { auto& frame = stack_array.at(i); auto ptr = frame.to_number(); u32 offset = 0;