xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Docs/Examples/lockbyproc_example.txt (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1*c29d5175SchristosThe following is a demonstration of the lockbyproc.d script,
2*c29d5175Schristos
3*c29d5175Schristos   # lockbyproc.d
4*c29d5175Schristos   dtrace: description 'lockstat:::adaptive-block ' matched 1 probe
5*c29d5175Schristos   ^C
6*c29d5175Schristos
7*c29d5175Schristos     pageout                                                       49438
8*c29d5175Schristos     mysql-test-run                                                96414
9*c29d5175Schristos     oracle                                                       149086
10*c29d5175Schristos     sched                                                        220601
11*c29d5175Schristos
12*c29d5175SchristosThe above output shows that threads belonging to sched, the kernel, spent
13*c29d5175Schristosa total of 220 microseconds waiting for an adaptive mutex lock.
14*c29d5175Schristos
15*c29d5175Schristos
16*c29d5175Schristos
17*c29d5175Schristos
18*c29d5175SchristosThis example sampled for a longer interval,
19*c29d5175Schristos
20*c29d5175Schristos   # lockbyproc.d
21*c29d5175Schristos   dtrace: description 'lockstat:::adaptive-block ' matched 1 probe
22*c29d5175Schristos   ^C
23*c29d5175Schristos
24*c29d5175Schristos     init                                                         136228
25*c29d5175Schristos     java                                                         371896
26*c29d5175Schristos     oracle                                                       783402
27*c29d5175Schristos     sched                                                       2315779
28*c29d5175Schristos     mysqltest                                                   9428277
29*c29d5175Schristos     mysql-test-run                                             10093658
30*c29d5175Schristos     mysqld                                                     17412999
31*c29d5175Schristos     fsflush                                                    19676738
32*c29d5175Schristos
33*c29d5175SchristosHere we can see threads belonging to fsflush have spent a total of 19.7 ms
34*c29d5175Schristoswaiting for an adaptive mutex. Note: it's not easy to say that it means a
35*c29d5175Schristos19.7 ms delay in the completion of the fsflush program, as this value is
36*c29d5175Schristosthe sum of the block times across all the threads. So it is possible that
37*c29d5175Schristosmany threads were blocked at the same time, eg, it could have been 19 threads
38*c29d5175Schristosblocked during the same 1 ms.
39*c29d5175Schristos
40*c29d5175Schristos
41*c29d5175Schristos
42*c29d5175Schristos
43