Profile fractal with perf and flamegraph
Today i looked into profiling Fractal. The graph below was created by running fractal for a short amount of time and switching frequently rooms.
You need to download the image and open it in the browser to get an interactive graph.
It's pretty clear that one of the more expensive operations involve the room history and the sidebar which both use a GtkListView
.
The flamegraph was created with the help of this guide https://gist.github.com/dlaehnemann/df31787c41bd50c0fe223df07cf6eb89
The follwoing commands where run in a flatpak runtime terminal in gnome builder:
perf record --call-graph dwarf,65528 -e cpu-clock -F 997 fractal
# Do stuff in fractal
git clone https://github.com/brendangregg/FlameGraph.git
wget https://raw.githubusercontent.com/Yamakaky/rust-unmangle/master/rust-unmangle
chmod a+x rust-unmangle
perf script | ./FlameGraph/stackcollapse-perf.pl | ./FlameGraph/stackcollapse-recursive.pl | c++filt | ./rust-unmangle | ./FlameGraph/flamegraph.pl > flame.svg
# Open the interactive flame.svg in browser
There is also https://github.com/flamegraph-rs/flamegraph
Edited by Kévin Commaille