OProfile
Setup
Minimum setup required: tell OProfile where is the vmlinux
file:
opcontrol --vmlinux=/boot/vmlinux-`uname -r`
Or if you don’t want to profile the kernel itself:
opcontrol --no-vmlinux
Start profiling
opcontrol --start
Periodically, profile data is written to $SESSION_DIR/samples
, default is
/var/lib/oprofile/samples
. Use --session-dir=<dir>
to specify the session
directory. Storing the data at other place so we can review the profile result
many times later.
To clear profile data
opcontrol --reset
Specifying performance counter events
Use --event
option to opcontrol
.
Syntax:
name:count:unitmask:kernel:user
Meaning:
name
– The symbolic event name, e.g. CPU_CLK_UNHALTEDcount
– The counter reset value, e.g. 100000unitmask
– The unit mask, as given in the events listkernel
– Whether to profile kernel codeuser
– Whether to profile userspace code
Getting report
opreport -l /boot/vmlinux-`uname -r`