Scripts for converts profilers output to flamegraph
Flamegraphs - https://github.com/brendangregg/FlameGraph
My versions of scripts to convert profiler output to folded stacks (other are staled or don't work for me).
- Collect data with EtwProf. Others profilers thar produce etl files are good too.
etwprof profile -t=418996 --output profile_result -m
This file can be opened with Windows Performance Analyze. It can show data as flamegraph, but I want to produce svg too.
-
Transform etl file in csv
xperf -i "profile.etl" -o perf.csv -target machine -symbols
-
Convert csv to folded_stacks format (it convert perf.csv to perf.folded)
xperf_csv_to_collapsed_stacks.py
- Run flamegraph.pl for convert folder stacks to svg file
flamegraph.pl perf.folded > perf.svg
It can be opened with any modern browser.
-
Profile application with Instruments -> Time profile. Select range of data that need to be exported.
-
(!) Choose profile output columns - number of samples, symbols. Disable all other columns
-
Select row that you want to export (root node for export all data). (!) Do not select all rows, just root.
-
Copy data (select Edit->Deep Copy from menu) and paste it to any text editor. Save file as sample.txt
-
Run
instruments_to_collapsed_stacks.py
-
Run flamegraph.pl for convert folder stacks to svg file
flamegraph.pl perf.folded > perf.svg
Also possible grab output from Intstruments -> Allocations similar
way. instruments_allocation_to_collapsed_stacks.py
script can convert it to folded stacks too.