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 definitions and detail of the components of the probe name are listed
in the following table.
Table 11-6 Probename Components
| |
event name
| The platform specific or generic event name. A full list of events can
be obtained using the -h option to cpustat(1M).
|
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 or event mask.
Available attribute names can be obtained through –h option
to the cpustat(1M) command.
The nouser and the sys attributes
are not accepted and should be specified at the mode 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 and cmask
= 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 we record the name of the executable that was on processor
at the time the probe fires (see Examples section
for further examples):
#!/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
gconfd-2 569
thunderbird-bin 1666
firefox-bin 2060
Note - When working with the cpc provider it is important
to remember 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. In the above output we see 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.