1 The following is an example of the sampleproc program. 2 3 4 Here we run sampleproc for a few seconds on a workstation, 5 6 # ./sampleproc 7 Sampling at 100 hertz... Hit Ctrl-C to end. 8 ^C 9 PID CMD COUNT 10 1659 mozilla-bin 3 11 109 nscd 4 12 2197 prstat 23 13 2190 setiathome 421 14 15 PID CMD PERCENT 16 1659 mozilla-bin 0 17 109 nscd 0 18 2197 prstat 5 19 2190 setiathome 93 20 21 The first table shows a count of how many times each process was sampled 22 on the CPU. The second table gives this as a percentage. 23 24 setiathome was on the CPU 421 times, which is 93% of the samples. 25 26 27 28 29 The following is sampleproc running on a server with 4 CPUs. A bash shell 30 is running in an infinate loop, 31 32 # ./sampleproc 33 Sampling at 100 hertz... Hit Ctrl-C to end. 34 ^C 35 PID CMD COUNT 36 10140 dtrace 1 37 28286 java 1 38 29345 esd 2 39 29731 esd 3 40 2 pageout 4 41 29733 esd 6 42 10098 bash 1015 43 0 sched 3028 44 45 PID CMD PERCENT 46 10140 dtrace 0 47 28286 java 0 48 29345 esd 0 49 29731 esd 0 50 2 pageout 0 51 29733 esd 0 52 10098 bash 24 53 0 sched 74 54 55 The bash shell was on the CPUs for 24% of the time, which is consistant 56 with a CPU bound single threaded application on a 4 CPU server. 57 58 The above sample was around 10 seconds long. During this time, there were 59 around 4000 samples (checking the COUNT column), this is due to 60 4000 = CPUs (4) * Hertz (100) * Seconds (10). 61 62 63