Profiling Configuration

OProfile has many configuration options, the amount of which can be overwhelming. For more information about these options, refer to http://oprofile.sourceforge.net/doc/controlling-daemon.html. The Profile Configurations menu provided by the OProfile plug-in aims to make relevant, commonly-used OProfile configuration options easily accessible to users of all experience levels. Currently, the Profile Configurations menu provides two configuration tabs to the standard CDT launch configuration: Global Settings and Event Configuration.

Since Linux Tools 2.1, the Oprofile plug-in supports opcontrol and operf as profiling tools. Both of them are explained as follows.

Operf vs Opcontrol

Legacy OProfile consists of the opcontrol shell script for configuring, starting, and stopping a profiling session. To this purpose, a kernel driver (usually built as a kernel module) is used for collecting samples, which are recorded into sample files. A disadvantage of this mode is the necessity of elevated user privileges to run opcontrol.

Operf was designed to be used in place of opcontrol for profiling. It uses the Linux Performance Events Subsystem, and therefore, does not require the use of the opcontrol daemon or any elevated privileges. The use of operf and opcontrol are mutually exclusive.

Global Settings

The Global Settings tab configures which profiling binary is going to be used (operf or opcontrol) and how the OProfile daemon gathers profiling information. Each option is described below.

Profile with
user can select opcontrol or operf as profiling tools.
Kernel Image File (optional)
To collect more detailed information about the operation of a program in the Linux kernel, use the Browse button specify the location of your running kernel's vmlinux file. A kernel's vmlinux file contains debugging information required by OProfile. Note that the compressed vmlinux file, often named vmlinuz, cannot be used for this purpose.
Note: For this option to have any effect, you must enable the Include dependent kernel modules option.
Include dependent shared libraries
This option will make OProfile include samples from shared libraries that are used by the profiled binary/program. These samples will then be aggregated in the profile results. This is performed by default when using operf.
Include dependent kernel modules
This option will make OProfile include samples related to running in the kernel. If the vmlinux file is specified, the profile will include details of the specific kernel modules in use. Otherwise, kernel samples will be grouped under the name no-vmlinux. Operf by default separates kernel samples per application.

The differences between the options are illustrated in the following OProfile view screenshot:

Event Configuration

Your system processor's hardware profiling registers often contain a large number of options. The Event Configuration tab condenses these options to a more manageable amount.

Timer Interrupt Mode

If your processor (or kernel) does not support the hardware profiling registers OProfile uses, OProfile will run in timer-interrupt mode. This mode has no user-configurable events. For more information about timer-interrupt mode, refer to http://oprofile.sourceforge.net/doc/detailed-parameters.html#timer.

The event configuration tab will then look like the screenshot below:

Regular Mode

If your processor (or kernel) supports hardware profiling registers, there are several configuration options available to you. The availability of these configuration options depend on your processor model or kernel version. With proper support, the Events configuration tab will look like the following screenshot:

In regular mode, the Events configuration tab can contain any of the following options:

Use default event
This option is enabled by default when creating a new profile configuration, or when a profile configuration is created through the one-click launch. Use default event is a shortcut to use an event based on processor execution time, with a reasonable value for the Count option. Using this option will prevent you from configuring the counters any further.
For a list of default events for various processors, refer to http://oprofile.sourceforge.net/doc/controlling.html#eventspec.
Counter Tabs ( Ctr 0 , Ctr 1 , Ctr 2 , and so on)
A processor may have 1 to 8 hardware profiling registers (also called counters). Each one may be programmed separately to profile many events simultaneously. Each tabs labelled Ctr represents one counter and exposes the same options.
Enabled
This option (located in each counter tab) disables or enables a counter.
Event List
A list of the events available for profiling on a given counter.
Event Description
When you select an event from the events list, this field provides a short description of that event's function. OProfile provides the content for this field.
Profile Kernel and Profile user binaries
Instructs OProfile to profile binaries in the selected spaces. Keeping both checked is recommended (even if other Global Settings are not specified).
Count
Specifies a reset count for the hardware counter. In most cases, the default value (based on the CPU clock frequency) is sufficient. Each event has a minimum value, but it is recommended to use a value many orders of magnitude larger.
WARNING: if you specify a value that is too low, the profiled program may take much longer to return or your system may hang.
Unit Mask
Many events have a unit mask which allows further narrowing of the scope of the event. If in doubt, use the default value (specified by OProfile). There are three types of unit masks: