profile
Timer Resolution
The profile
provider uses arbitrary resolution interval timers in the operating system. On architectures that do not support arbitrary resolution time-based interrupts, the frequency is limited by the system clock frequency, which is specified by the hz
kernel variable. Probes of higher frequency than hz
on such architectures will fire some number of times every 1/hz
seconds. For example, a 1000 hertz profile
probe on such an architecture with hz
set to 100 would fire ten times in rapid succession every ten milliseconds. On platforms that support arbitrary resolution, a 1000 hertz profile
probe would fire exactly every one millisecond.
Example 11-11 Reporting Platform Resolution From the Profile Probe
The following example tests a given architecture's resolution:
profile-5000 { /* * Divide by 1,000,000 to convert nanoseconds to milliseconds, and * then take the value mod 10 to get the current millisecond within * a 10 millisecond window. On platforms that do not support truly * arbitrary resolution profile probes, all of the profile-5000 probes * will fire on roughly the same millisecond. On platforms that * support a truly arbitrary resolution, the probe firings will be * evenly distributed across the milliseconds. */ @ms = lquantize((timestamp / 1000000) % 10, 0, 10, 1); } tick-1sec /i++ >= 10/ { exit(0); }
On an architecture that supports arbitrary resolution profile
probes, running the example script will yield an even distribution:
# dtrace -s ./restest.d
dtrace: script './restest.d' matched 2 probes
CPU ID FUNCTION:NAME
0 33631 :tick-1sec
value ------------- Distribution ------------- count
< 0 | 0
0 |@@@ 10760
1 |@@@@ 10842
2 |@@@@ 10861
3 |@@@ 10820
4 |@@@ 10819
5 |@@@ 10817
6 |@@@@ 10826
7 |@@@@ 10847
8 |@@@@ 10830
9 |@@@@ 10830
On an architecture that does not support arbitrary resolution profile
probes, running the example script will yield an uneven distribution:
# dtrace -s ./restest.d
dtrace: script './restest.d' matched 2 probes
CPU ID FUNCTION:NAME
0 28321 :tick-1sec
value ------------- Distribution ------------- count
4 | 0
5 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 107864
6 | 424
7 | 255
8 | 496
9 | 0
On these architectures, hz
may be manually tuned in /etc/system
to improve the effective profile resolution.
Currently, all variants of UltraSPARC (sun4v
) support arbitrary resolution profile
probes. Many variants of the x86 architecture (i86pc
) also support arbitrary resolution profile
probes, although some older variants do not support arbitrary resolution profile
probes.