The arguments to sysinfo probes are as follows:
arg0 |
The value by which the statistic is to be incremented. For most probes, this argument is always 1, but for some probes this argument may take other values. |
arg1 |
A pointer to the current value of the statistic to be incremented. This value is a 64–bit quantity that will be incremented by the value in arg0. Dereferencing this pointer enables consumers to determine the current count of the statistic corresponding to the probe. |
arg2 |
A pointer to the cpu_t structure that corresponds to the CPU on which the statistic is to be incremented. This structure is defined in <sys/cpuvar.h>, but it is part of the kernel implementation and should be considered Private. |
The value of arg0 is 1 for most sysinfo probes. However, the readch and writech probes set arg0 to the number of bytes read or written, respectively. This features permits you to determine the size of reads by executable name, as shown in the following example:
# dtrace -n readch'{@[execname] = quantize(arg0)}' dtrace: description 'readch' matched 4 probes ^C xclock value ------------- Distribution ------------- count 16 | 0 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 64 | 0 acroread value ------------- Distribution ------------- count 16 | 0 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 64 | 0 FvwmAuto value ------------- Distribution ------------- count 2 | 0 4 |@@@@@@@@@@@@@ 13 8 |@@@@@@@@@@@@@@@@@@@@@ 21 16 |@@@@@ 5 32 | 0 xterm value ------------- Distribution ------------- count 16 | 0 32 |@@@@@@@@@@@@@@@@@@@@@@@@ 19 64 |@@@@@@@@@ 7 128 |@@@@@@ 5 256 | 0 fvwm2 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@ 186 1 | 0 2 | 0 4 |@@ 51 8 | 17 16 | 0 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@ 503 64 | 9 128 | 0 Xsun value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@ 269 1 | 0 2 | 0 4 | 2 8 |@ 31 16 |@@@@@ 128 32 |@@@@@@@ 171 64 |@ 33 128 |@@@ 85 256 |@ 24 512 | 8 1024 | 21 2048 |@ 26 4096 | 21 8192 |@@@@ 94 16384 | 0 |
The sysinfo provider sets arg2 to be a pointer to a cpu_t, a structure internal to the kernel implementation. Most sysinfo probes fire on the CPU on which the statistic is being incremented, but some probes do not. The exceptional probes include cpu_ticks_idle, cpu_ticks_kernel, cpu_ticks_user and cpu_ticks_wait, which always fire on the CPU executing the system clock. Use the cpu_id member of the cpu_t structure to determine the CPU of interest. The following D script runs for about ten seconds and gives a quick snapshot of relative CPU behavior on a statistic-by-statistic basis:
cpu_ticks_* { @[probename] = lquantize(((cpu_t *)arg2)->cpu_id, 0, 1024, 1); } tick-1sec /x++ >= 10/ { exit(0); }
Running the above script results in output similar to the following example:
# dtrace -s ./tick.d dtrace: script './tick.d' matched 5 probes CPU ID FUNCTION:NAME 22 37588 :tick-1sec cpu_ticks_user value ------------- Distribution ------------- count 11 | 0 12 |@@@@@@@@ 14 13 |@@@@ 7 14 |@ 3 15 |@ 2 16 |@@ 4 17 |@@@@@@ 10 18 | 0 19 |@ 2 20 |@@@ 6 21 |@@@ 5 22 | 1 23 |@@@@@@ 10 24 | 0 cpu_ticks_wait value ------------- Distribution ------------- count 11 | 0 12 |@@@@@@@@@@@@@ 241 13 |@@@@@@@@@@@@@ 236 14 | 16 15 |@@@@@@@ 132 16 | 11 17 | 10 18 | 7 19 |@ 18 20 | 4 21 | 16 22 | 13 23 | 10 24 | 0 cpu_ticks_kernel value ------------- Distribution ------------- count 11 | 0 12 |@@@@@@@@ 234 13 |@@@@@ 159 14 |@@@ 104 15 |@@@@ 131 16 |@@ 66 17 |@ 40 18 |@ 51 19 |@ 36 20 |@@ 56 21 |@ 42 22 |@@@ 96 23 |@@ 57 24 | 0 cpu_ticks_idle value ------------- Distribution ------------- count 11 | 0 12 |@@ 534 13 |@@ 621 14 |@@@ 900 15 |@@ 758 16 |@@@ 942 17 |@@@ 963 18 |@@@ 965 19 |@@@ 967 20 |@@@ 957 21 |@@@ 960 22 |@@@ 913 23 |@@@ 946 24 | 0 |