FlameGraphs-Instruments
FlameGraphs-Instruments copied to clipboard
A command-line tool for generating interactive SVG flame graphs based on Xcode Instruments traces files.
FlameGraphs-Instruments
中文版
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.
FlameGraph
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.
FlameGraph-Swift
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.
Installation
Swift Package Manager
$ git clone [email protected]:Kelvenbit/FlameGraphs-Instruments.git
Usage
- 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
.
License
FlameGraphs-Instruments is licensed under the MIT License. See the LICENSE file for details.