Support for "Invert Call Tree" Xcode Instruments output #314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
When the "Invert Call Tree" setting is on in Instruments, the resulting output does not have reliable "Self Weight" columns: they only contain "0 s" past depth 1. This adds a new mode, as a new "--inverted" option to stack collapse-instruments.pl, to enable processing this format.
No, I mean, why not just process the regular Instruments format and invert it using the --reverse option of flamegraph.pl?
That is preferable in general: this --inverted option instead relies on "Weights", which requires some adjustments to the values therein, including potential roundoff inaccuracies. However in some cases it is worth relying on data mining performed by Instruments, some of which works better when it is itself responsible for the inversion. For instance, Instruments has an option to collapse a library to its boundary frames; in regular mode, the library frames are collapsed to the library entry point (represented by the attached nonreg.svg), while in "Invert Call Tree" mode the same frames are collapsed to their topmost frame, which is often more interesting (represented by the attached time-reduced-self-node-calls.svg ; that one was further reversed by flamegraph.pl for better comparison).