Perf
From Attie's Wiki
(Difference between revisions)
(Created page with "==Install== <source lang="bash"> apt-get install linux-tools-common linux-tools-$(uname -r) </source> ==Using==") |
m |
||
(4 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | [http://www.brendangregg.com/perf.html perf Examples] | ||
+ | |||
==Install== | ==Install== | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 5: | Line 7: | ||
==Using== | ==Using== | ||
+ | ===The Basics=== | ||
+ | <source lang="bash"> | ||
+ | # 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 | ||
+ | </source> | ||
+ | |||
+ | ===Record a Call Graph=== | ||
+ | <source lang="bash"> | ||
+ | perf record -g -p ${PID} | ||
+ | </source> | ||
+ | |||
+ | ===Record for 30 seconds=== | ||
+ | <source lang="bash"> | ||
+ | perf record -p ${PID} sleep 30 | ||
+ | </source> |
Latest revision as of 10:52, 2 March 2015
Contents |
[edit] Install
apt-get install linux-tools-common linux-tools-$(uname -r)
[edit] Using
[edit] 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
[edit] Record a Call Graph
perf record -g -p ${PID}
[edit] Record for 30 seconds
perf record -p ${PID} sleep 30