1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

ProfileView: Show "self" sample counts in profiles

The "self" sample count is the number of samples that had this specific
frame as its innermost stack frame (leaf nodes in the profile tree.)
This commit is contained in:
Andreas Kling 2020-03-02 21:37:19 +01:00
parent 8e8e8c801c
commit 8effe0b632
4 changed files with 14 additions and 4 deletions

View file

@ -117,18 +117,18 @@ void Profile::rebuild_tree()
{
if (!m_inverted) {
for (size_t i = 0; i < event.frames.size(); ++i) {
if (callback(event.frames.at(i)) == IterationDecision::Break)
if (callback(event.frames.at(i), i == event.frames.size() - 1) == IterationDecision::Break)
break;
}
} else {
for (ssize_t i = event.frames.size() - 1; i >= 0; --i) {
if (callback(event.frames.at(i)) == IterationDecision::Break)
if (callback(event.frames.at(i), static_cast<size_t>(i) == event.frames.size() - 1) == IterationDecision::Break)
break;
}
}
};
for_each_frame([&](const Frame& frame) {
for_each_frame([&](const Frame& frame, bool is_innermost_frame) {
auto& symbol = frame.symbol;
auto& address = frame.address;
auto& offset = frame.offset;
@ -142,6 +142,8 @@ void Profile::rebuild_tree()
node = &node->find_or_create_child(symbol, address, offset, event.timestamp);
node->increment_event_count();
if (is_innermost_frame)
node->increment_self_count();
return IterationDecision::Continue;
});
}