Perf
From Attie's Wiki
(Difference between revisions)
m (→Using) |
m (→The Basics) |
||
Line 9: | Line 9: | ||
# Unrestrict the kernel symbol maps | # Unrestrict the kernel symbol maps | ||
echo -n 0 | sudo tee /proc/sys/kernel/kptr_restrict > /dev/null | echo -n 0 | sudo tee /proc/sys/kernel/kptr_restrict > /dev/null | ||
+ | # Permit users to mlock() more memory - useful when running multiple instances of perf | ||
+ | echo -n 2048 | sudo tee /proc/sys/kernel/perf_event_mlock_kb > /dev/null | ||
# start the process, and get its PID | # start the process, and get its PID |
Revision as of 13:29, 20 February 2015
Contents |
Install
apt-get install linux-tools-common linux-tools-$(uname -r)
Using
The Basics
# Unrestrict the kernel symbol maps echo -n 0 | sudo tee /proc/sys/kernel/kptr_restrict > /dev/null # Permit users to mlock() more memory - useful when running multiple instances of perf echo -n 2048 | sudo tee /proc/sys/kernel/perf_event_mlock_kb > /dev/null # start the process, and get its PID # record some data, to perf.data (kill perf when done) perf record -p ${PID} # review the recorded data perf report --stdio
Record a Call Graph
perf record -g -p ${PID}
Record for 30 seconds
perf record -p ${PID} sleep 30