More details here.
Run process, record off cpu data for it for 60 seconds, create flamegraph and view it.
./my_process
offcputime -f -p $(pidof my_process) 60 | tee my_process.stacks
flamegraph.pl --color=io --inverted my_process.stacks > my_process.svg
chromium my_process.svg