FlameGraphs-Instruments is a command-line tool that generates interactive SVG flame graphs based on Xcode Instruments traces files.
This project was created after researching the source code of two flame graph implementations.
Author of "Systems Performance," Brendan Gregg proposed Flame Graphs which uses interactive SVG format. The downside is that stackcollapse-instruments.pl has not been updated for several years, and the latest traces format cannot be parsed.
Implemented in Swift, it mainly parses CSV format data and generates flame graphs in PNG, JPG, PDF, and HTML formats. It is simple and easy to use, but the generated format is not interactive and cannot view deeper stack levels. When the stack level is too high, the text display is incomplete.
Combining the advantages of the above two projects, FlameGraphs-Instruments has made the following optimizations:
- Supports Instruments traces parsing.
- Outputs interactive SVG format, supporting click and level view.
- Supports parsing
CPU Profiler
andTime Profiler
. - Filters stacks with a 0.0% Weight.
$ git clone git@github.com:Kelvenbit/FlameGraphs-Instruments.git
- Run Instruments and select
Time Profiler
orCPU Profiler
. - Select the stack.
- Use the menu
Edit > Deep copy ⇧⌘C
to copy the full stack to the clipboard. - Enter the directory
cd FlameGraphs-Instruments
. - Execute
swift run FlameGraph output.svg
orswift run FlameGraph -f intput.csv output.svg
.
FlameGraphs-Instruments is licensed under the MIT License. See the LICENSE file for details.