cpc
Probes
Probes made available by the cpc
provider have the following format:
cpc:::event name-mode[-attributes]-count
The format of attributes
is:
attr1_val1[-attr2_val2...]|value
The cpc
probe names and meaning are the following:
-
event name
-
The platform specific or generic event name. A full list of events can be obtained using the
-h
option with thecpustat
command. -
mode
-
The privilege mode in which to count events. Valid modes are "user" for user mode events, "kernel" for kernel mode events and "all" for both user mode and kernel mode events.
-
attributes
-
This component is optional and accepts one or more event attributes. On some platforms it is possible to specify event attributes to further refine a platform specific event specification. The attributes can only be specified for platform specific events.
The attributes are specified as name-value pairs or single value in the following format:
attr1_val1[-attr2_val2...]|value
-
The attributes (attr1, attr2, and so on) are the string names of the platform-specific attributes.
-
The values (val1, val2, and so on) are the hex values for the corresponding attributes.
Note:
-
If only a value without attribute name is specified, it is interpreted as a mask value. The mask value is commonly referred to as a
unit mask
orevent mask
. -
Available attribute names can be obtained through
-h
option with thecpustat
command. -
The
nouser
and thesys
attributes are not accepted and should be specified at themode
component.
-
-
count
-
The number of events that must occur on a CPU for a probe to be fired on that CPU.
A sample usage of the cpc
provider is as follows:
cpc:::BU_fill_req_missed_L2-all-umask_0x7-cmask_0x0-10000
In this example, the parameters are set to the following values:
-
Event name is set to
BU_fill_req_missed_L2
-
Mode is set to
all
-
Attributes are set to
umask = 0x7
andcmask = 0x0
-
Count is set to
10000
The following introductory example fires a probe on a CPU for every 10000 user-mode Level 1 instruction cache misses on a SPARC platform. When the probe fires, record the name of the executable that was on processor at the time the probe fires.
#!/usr/sbin/dtrace -s #pragma D option quiet cpc:::IC_miss-user-10000 { @[execname] = count(); } END { trunc(@, 10); }
# ./user-l1miss.d
^C
dirname 8
firefox 8
sed 11
intrd 12
run-mozilla.sh 13
java 64
sshd 135
thunderbird-bin 1666
firefox-bin 2060
Note:
When working with thecpc
provider, note that the state available when a probe fires is valid for the performance counter event that caused the probe to fire and not for all events counted with that probe. The preceding output shows that the firefox-bin
application caused the cpc:::IC_miss-user-10000
probe to fire 2060 times. As this probe fires once for every 10000 level 1 instruction cache misses on a CPU, the firefox-bin
application could have contributed anywhere from 2060 to 20600000 of these misses.
For more examples, see Using the cpc Provider.