1 The following are demonstrations of the pridist.d script.
4 Here we run pridist.d for a few seconds then hit Ctrl-C,
7 Sampling... Hit Ctrl-C to end.
9 CMD: setiathome PID: 2190
11 value ------------- Distribution ------------- count
13 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6629
18 value ------------- Distribution ------------- count
20 55 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
23 CMD: mozilla-bin PID: 3164
25 value ------------- Distribution ------------- count
27 45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 20
32 value ------------- Distribution ------------- count
36 25 |@@@@@@@@@@@@@@@ 120
45 During this sample there was a CPU bound process called "setiathome"
46 running, and a new CPU bound "perl" process was executed.
48 perl, executing an infinite loop, begins with a high priority of 55 to 59
49 where it is sampled 20 times. pridist.d samples 1000 times per second,
50 so this equates to 20 ms. The perl process has also been sampled for 40 ms
51 at priority 45 to 49, for 80 ms at priority 35 to 39, down to 60 ms at a
52 priority 15 to 19 - at which point I had hit Ctrl-C to end sampling.
54 The output is spectacular as it matches the behaviour of the dispatcher
55 table for the time sharing class perfectly!
57 setiathome is running with the lowest priority, in the 0 to 4 range.
59 ... ok, so when I say 20 samples equates 20 ms, we know that's only an
60 estimate. It really means that for 20 samples that process was the one on
61 the CPU. In between the samples anything may have occured (I/O bound
62 processes will context switch off the CPU). DTrace can certainly be used
63 to measure this based on schedular events not samples (eg, cpudist),
64 however DTrace can then sometimes consume a noticable portion of the CPUs
70 The following is a longer sample. Again, I start a new CPU bound perl
74 Sampling... Hit Ctrl-C to end.
76 CMD: setiathome PID: 2190
78 value ------------- Distribution ------------- count
80 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1820
83 CMD: mozilla-bin PID: 3164
85 value ------------- Distribution ------------- count
87 45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
92 value ------------- Distribution ------------- count
94 55 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
99 value ------------- Distribution ------------- count
101 0 |@@@@@@@@@@@@@@@ 2020
115 Now other behaviour can be observed as the perl process runs. The effect
116 here is due to ts_maxwait triggering a priority boot to avoid CPU starvation;
117 the priority is boosted to the 50 to 54 range, then decreases by 10 until
118 it reaches 0 and another ts_maxwait is triggered. The process spends
119 more time at lower priorities, as that is exactly how the TS dispatch table
125 Now we run prdist.d for a considerable time,
128 Sampling... Hit Ctrl-C to end.
130 CMD: setiathome PID: 2190
132 value ------------- Distribution ------------- count
134 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3060
137 CMD: mozilla-bin PID: 3164
139 value ------------- Distribution ------------- count
141 45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 20
146 value ------------- Distribution ------------- count
148 0 |@@@@@@@@@@@@@@@@@@@ 7680
162 The process has settled to a pattern of 0 priority, ts_maxwait boot to 50,
165 Run "dispadmin -c TS -g" for a printout of the time sharing dispatcher table.
171 The following shows running pridist.d on a completely idle system,
174 Sampling... Hit Ctrl-C to end.
178 value ------------- Distribution ------------- count
180 -5 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1190
183 Only the kernel "sched" was sampled. It would have been running the idle
189 The following is an unusual output that is worth mentioning,
192 Sampling... Hit Ctrl-C to end.
196 value ------------- Distribution ------------- count
198 -5 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 940
235 Here we have sampled the kernel running at a priority of 165 to 169. This
236 is the interrupt priority range, and would be an interrupt servicing thread.
237 Eg, a network interrupt.