40.2. Configuring OProfile
Before OProfile can be run, it must be configured. At a minimum, selecting to monitor the kernel (or selecting not to monitor the kernel) is required. The following sections describe how to use the
opcontrolutility to configure OProfile. As the
opcontrolcommands are executed, the setup options are saved to the
40.2.1. Specifying the Kernel
First, configure whether OProfile should monitor the kernel. This is the only configuration option that is required before starting OProfile. All others are optional.
To monitor the kernel, execute the following command as root:
opcontrol --setup --vmlinux=/usr/lib/debug/lib/modules/`uname -r`/vmlinux
debuginfopackage must be installed (which contains the uncompressed kernel) in order to monitor the kernel.
To configure OProfile not to monitor the kernel, execute the following command as root:
opcontrol --setup --no-vmlinux
This command also loads the
oprofilekernel module, if it is not already loaded, and creates the
/dev/oprofile/directory, if it does not already exist. Refer to Section 40.6, “Understanding
/dev/oprofile/” for details about this directory.
Even if OProfile is configured not to profile the kernel, the SMP kernel still must be running so that the
oprofilemodule can be loaded from it.
Setting whether samples should be collected within the kernel only changes what data is collected, not how or where the collected data is stored. To generate different sample files for the kernel and application libraries, refer to Section 40.2.3, “Separating Kernel and User-space Profiles”.