English Spanish
[command]#operf# [option]`--events`pass:attributes[{blank}]=pass:attributes[{blank}]_event1_,_event2_pass:attributes[{blank}]…
Here, pass a comma-separated list of event specifications for profiling. Each event specification is a colon-separated list of attributes in the following form:
_event-name_:pass:attributes[{blank}]_sample-rate_:pass:attributes[{blank}]_unit-mask_:pass:attributes[{blank}]_kernel_:pass:attributes[{blank}]_user_
xref:OProfile.adoc#tab_event_specifications[Event Specifications] summarizes these options. The last three values are optional, if you omit them, they will be set to their default values. Note that certain events do require a unit mask.
Event Specifications
|Specification|Description
|_event-name_|The exact symbolic event name taken from [command]#ophelp#
|_sample-rate_|The number of events to wait before sampling again. The smaller the count, the more frequent the samples. For events that do not happen frequently, a lower count may be needed to capture a statistically significant number of event instances. On the other hand, sampling too frequently can overload the system. By default, OProfile uses a time-based event set, which creates a sample every 100,000 clock cycles per processor.
|_unit-mask_|Unit masks, which further define the event, are listed in [command]#ophelp#.
You can insert either a hexadecimal value, beginning with "0x", or a string that matches the first word of the unit mask description in [command]#ophelp#. Definition by name is valid only for unit masks having "extra:" parameters, as shown by the output of [command]#ophelp#. This type of unit mask cannot be defined with a hexadecimal value. Note that on certain architectures, there can be multiple unit masks with the same hexadecimal value. In that case they have to be specified by their names only.
|_kernel_|Specifies whether to profile kernel code (insert `0` or `1`(default))
|_user_|Specifies whether to profile user-space code (insert `0` or `1` (default))
The events available vary depending on the processor type. When no event specification is given, the default event for the running processor type will be used for profiling. See xref:OProfile.adoc#tb-oprofile-default-events[Default Events] for a list of these default events. To determine the events available for profiling, use the [command]#ophelp# command.
[command]#ophelp#
Categorization of Samples
The [option]`--separate-thread` option categorizes samples by thread group ID (tgid) and thread ID (tid). This is useful for seeing per-thread samples in multi-threaded applications. When used in conjunction with the [option]`--system-wide` option, [option]`--separate-thread` is also useful for seeing per-process (i.e., per-thread group) samples for the case where multiple processes are executing the same program during a profiling run.
The [option]`--separate-cpu` option categorizes samples by CPU.
Configuring OProfile Using Legacy Mode
indexterm:[OProfile,configuring]indexterm:[OProfile,opcontrol]indexterm:[opcontrol,OProfile] Before OProfile can be run in legacy mode, 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 [command]#opcontrol# utility to configure OProfile. As the [command]#opcontrol# commands are executed, the setup options are saved to the `/root/.oprofile/daemonrc` file.
indexterm:[OProfile,monitoring 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`: indexterm:[OProfile,opcontrol,--vmlinux=]
~]# opcontrol --setup --vmlinux=/usr/lib/debug/lib/modules/`uname -r`/vmlinux
Install the debuginfo package
In order to monitor the kernel, the [package]*debuginfo* package which contains the uncompressed kernel must be installed.
To configure OProfile not to monitor the kernel, execute the following command as `root`: indexterm:[OProfile,opcontrol,--no-vmlinux]
~]# opcontrol --setup --no-vmlinux