-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a "top functions" call tree view #15
Comments
FWIW, Jan de Mooij built an external tool to help find the top functions: https://jandem.github.io/profileviewer/ Would it be possible to use that as a starting point to get something like this added to perf.html? |
The hotspot tool has a nice view that is similar to what Markus suggested: |
Note that the view is sortable both by self time or children-included time. |
@mikeconley is that the Heaviest Stack Trace sidebar from Instruments If not, Instruments has also the Top Functions view options for the call tree. It also sounds similar to your description, as Top Functions is defined as
|
See also this butterfly view experiment (where functions are ordered by self time instead of running time like it should) |
This also came up in user feedback again as a list of hot spots that help to orient in a profile. |
Here is the updated butterfly view experiment, this time using the running time. |
I like it, but the UI does take its own tab and we'll have to train users on its own workflow. I wonder if a v0 for this could be simpler. XCode solves it as checkbox in the call tree; which exposes it similarly to "Invert Call Tree" – which seems nice as it has a similar explorational use case. @mstange @mikeconley would love your input on this Call Tree-based approach. |
I don't have a strong opinion. But I think a tri-state selector in the Call Tree tab might work:
(actual names to be discussed) |
Interestingly I thought of that too :-) The tab was a cheap way to get it out but I think we can do better. |
Could we start with the most simple version of this, just the top functions list, no butterfly view? IMO this would make the profiler a lot more effective. I feel kind of lost when looking at complicated profiles without this view (I use it all the time with other profilers such as Instruments). |
I'm a bit confused by the top functions view. Is this any different than the inverted view in the call tree? |
Here's an example: (edit: I've also added this to the issue description now)
The top functions view calls attention to |
The inverted view orders by the self time, the functions view orders by the running time. Thanks for the heads-up, I'll put that in our internal backlog |
@jandem @mstange would cleaning up the work linked in #15 (comment) be good enough as a first step? (see #2388 for the list of left-over tasks). I feel like it needs some more relationships with the other panels, but this can also be built on top of it later. |
Yes, I think that would be a good first step. You could even drop the side panels for now and just have the top functions list. But we do need the performance to be addressed, see my comment in the PR. |
That looks amazing. Thanks! |
Here's a profile where a top functions view would work very well: https://share.firefox.dev/3rM8fEp |
Somewhat related, I was wanting to filter to just a single function the other day profiling |
I propose to add a simple version of this in #4205. |
Implementation notes: A naive implementation of this would walk the entire stack for each sample, and accumulate the sample's weight into a total-per-function array. However, it would also need to create a Set of functions for the current sample, to ensure that, if the same function is present in the stack multiple times, it only gets counted once. Walking the entire stack for each sample is costly. Maintaining a set is costly too. We should find something we can precompute based on the non-inverted call node table, so that if the sample information changes (e.g. because the user's preview range selection changes), it will be quick to recompute the total-per-function information. I think a performant implementation of this could work as follows:
This gives you a per-function total that's relatively cheap to update as the selection changes. The tricky part is how to create |
I've prototyped the described approach in #5233. |
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:
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:
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
The text was updated successfully, but these errors were encountered: