EmbarkStudios/puffin

Hierarchical mode for stats view

tgolsson opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

When optimizing, one of my favourite approaches is the parent% metric. This isn't too hard to compute, but right now the viewer doesn't present the data in an accessible way. What I want is a tree where the root nodes are the top level scopes, and each layer only has the statistics for the node when called from that parent.

Describe the solution you'd like

A view something like this:

scope                          self      parent%     total%
└── app-update                 13ms      100%        100%
    ├── input                  1ms       7%          7%
    │   ├── keyboard           300us     30%         2.1%
    │   └── mouse              100us     10%         0.7%
    ├── ai                     4ms       30%         30%
    │   ├── raycasts           1ms       25%         7.5%
    │   └── navigation         2.5ms     62.5%       20%
    └── player                 2ms       15%         15%
        └── weapon             0.5ms     25%         3.25%
            ├── raycasts       0.2ms     40%         1.3%
            └── hitmarker      0.2ms     40%         1.3%

I don't think the view necessarily has to present % - I think being able to correlate parent/child relationship of scopes is the important part.

Describe alternatives you've considered

This can be somewhat manually created by carefully finding the immediate children in the flamegraph, and then filtering the stats view. If there was a way to highlight or filter descendants that'd make it somewhat easier with the current tool. However, since some scopes might have multiple parents (e.g. raycasts above) it doesn't quite get there.

Additional context

This is an example of how it's presented in Firefox Performance view:
image