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