Whether profiling with operf or doing simple event counting with ocount,
you can collect information about one more native hardware events using the --events
option -- a comma-separated list of event specfications. The event specification is the means to provide details
of how each hardware performance counter should be set up.
For profiling, the event specification is a colon-separated string of the form
name:count:unitmask:kernel:user
as described in the table below. For ocount, specification is of the form
name:unitmask:kernel:user
.
Note the presence of the count field for profiling. The count field tells the profiler
how many events should occur between a profile snapshot (usually referred to as a "sample"). Since
ocount does not do sampling, the count field is not needed.
If no event specs are passed to operf or ocount, the default event will be used.
name
|
The symbolic event name, e.g. CPU_CLK_UNHALTED |
count
|
The counter reset value, e.g. 100000; use only for profiling |
unitmask
|
The unit mask, as given in the events list: e.g. 0x0f; or a symbolic name
if a name=<um_name> field is present |
kernel
|
Enable profiling of kernel code |
user
|
Enable profiling of userspace code |
The last three values are optional; if you omit them (e.g. operf --events=DATA_MEM_REFS:30000
),
they will be set to the default values (i.e., the default unit mask value for the given event, and profiling (or counting)
both kernel and userspace code will be enabled). Note that on some architectures, some events may
require a unit mask be specified.
You can specify unit mask values using either a numerical value (hex values
must begin with "0x") or a symbolic name (if the name=<um_name>
field is shown in the ophelp output). For some named unit masks, the hex value is not unique; thus, OProfile
tools enforce specifying such unit masks value by name.
The table below lists the default profiling event for various processor types. The same events can be used for ocount, minus the count field.
Processor | cpu_type | Default event |
Alpha EV67 | alpha/ev67 | CYCLES:100000:0:1:1 |
ARM/XScale PMU1 | arm/xscale1 | CPU_CYCLES:100000:0:1:1 |
ARM/XScale PMU2 | arm/xscale2 | CPU_CYCLES:100000:0:1:1 |
ARM/MPCore | arm/mpcore | CPU_CYCLES:100000:0:1:1 |
Athlon | i386/athlon | CPU_CLK_UNHALTED:100000:0:1:1 |
Pentium Pro | i386/ppro | CPU_CLK_UNHALTED:100000:0:1:1 |
Pentium II | i386/pii | CPU_CLK_UNHALTED:100000:0:1:1 |
Pentium III | i386/piii | CPU_CLK_UNHALTED:100000:0:1:1 |
Pentium M (P6 core) | i386/p6_mobile | CPU_CLK_UNHALTED:100000:0:1:1 |
Pentium 4 (non-HT) | i386/p4 | GLOBAL_POWER_EVENTS:100000:1:1:1 |
Pentium 4 (HT) | i386/p4-ht | GLOBAL_POWER_EVENTS:100000:1:1:1 |
Hammer | x86-64/hammer | CPU_CLK_UNHALTED:100000:0:1:1 |
Family10h | x86-64/family10 | CPU_CLK_UNHALTED:100000:0:1:1 |
Family11h | x86-64/family11h | CPU_CLK_UNHALTED:100000:0:1:1 |
IBM pseries | ppc64/power{ 4|5|6|7|8|9|970 } | CYCLES:100000:0:1:1 |
IBM s390 | s390/{ z10|z196|zEC12 } | HWSAMPLING:4127518:0:1:1 |