Skip to content

Instantly share code, notes, and snippets.

@paroj
Last active January 28, 2020 17:49
Show Gist options
  • Save paroj/6bb7547b2b5b7367fd149c91b58cd53e to your computer and use it in GitHub Desktop.
Save paroj/6bb7547b2b5b7367fd149c91b58cd53e to your computer and use it in GitHub Desktop.
#!/bin/sh
# compile with -fno-omit-frame-pointer
# usermode
sudo sh -c "echo 0 > /proc/sys/kernel/kptr_restrict"
sudo sh -c 'echo 1 >/proc/sys/kernel/perf_event_paranoid'
# record with callgraph
perf record -g $1
# display with inverse callgraph
perf report -g 'graph,0.5,caller'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment