firefox-devtools / firefox-devtools/profiler

Add a "top functions" call tree view

Open
#15 23 comments 0 reactions 0 assignees View on GitHub
call tree quantum flow
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 46m
Merged PRs (30d)
27

Description

In a "top functions" view, all functions are displayed in a flat list (no tree structure), sorted by "inclusive time", i.e. sorted by the number of samples where this function is present _anywhere on the stack_.

Example:

```
Normal:

total self
19 - (root)
19 - RunLoop
10 - ProcessCircles
10 2 ProcessElement
8 8 Circle::Circumference()
9 - ProcessSquares
9 3 ProcessElement
6 6 Square::Circumference()

Inverted:

total self
8 8 Circle::Circumference()
8 - ProcessElement
8 - ProcessCircles
8 - RunLoop
8 - (root)
6 6 Square::Circumference()
6 - ProcessElement
6 - ProcessSquares
6 - RunLoop
6 - (root)
5 5 ProcessElement
5 - ProcessSquares
5 - RunLoop
5 - (root)
5 - ProcessCircles
5 - RunLoop
5 - (root)

Top functions:

total self
19 - (root)
19 - RunLoop
19 5 ProcessElement
10 - ProcessCircles
9 - ProcessSquares
8 8 Circle::Circumference()
6 6 Square::Circumference()
```

In this example, `ProcessElement` is near the top of the list, and easy to find. In the current call tree you have to look for it under two different stacks.

---

I think we should have such a mode. We could make it a different mode inside the existing Call Tree tab, or we could have a new tab for it.

---

As a follow up, outside of the scope of this issue, it should would be nice to have the following abilities for each function:

1. Restrict the profile to only show samples that contained this function in the stack
1. Do the inverse of 1, i.e. remove all samples containing this function in the stack
1. Look at the call tree of functions called by the selected function
1. Look at the (inverted) call tree of functions that call the selected function

For example, we could split the tab three ways: the list on the left, and two tree views on the right, above each other, with the upper one showing 3 and the lower one showing 4.

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-88)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.