8916 man pages should refer to our own Dynamic Tracing Guide
[unleashed.git] / usr / src / man / man1m / lockstat.1m
bloba6798ed849805cd0f2bb575c1f1f35ae585aadd5
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH LOCKSTAT 1M "Dec 10, 2017"
7 .SH NAME
8 lockstat \- report kernel lock and profiling statistics
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBlockstat\fR [\fB-ACEHI\fR] [\fB-e\fR \fIevent_list\fR] [\fB-i\fR \fIrate\fR]
13      [\fB-b\fR | \fB-t\fR | \fB-h\fR | \fB-s\fR \fIdepth\fR] [\fB-n\fR \fInrecords\fR]
14      [\fB-l\fR \fIlock\fR [, \fIsize\fR]] [\fB-d\fR \fIduration\fR]
15      [\fB-f\fR \fIfunction\fR [, \fIsize\fR]] [\fB-T\fR] [\fB-ckgwWRpP\fR] [\fB-D\fR \fIcount\fR]
16      [\fB-o\fR \fIfilename\fR] [\fB-x\fR \fIopt\fR [=val]] \fIcommand\fR [\fIargs\fR]
17 .fi
19 .SH DESCRIPTION
20 .LP
21 The \fBlockstat\fR utility gathers and displays kernel locking and profiling
22 statistics. \fBlockstat\fR allows you to specify which events to watch (for
23 example, spin on adaptive mutex, block on read access to rwlock due to waiting
24 writers, and so forth) how much data to gather for each event, and how to
25 display the data. By default, \fBlockstat\fR monitors all lock contention
26 events, gathers frequency and timing data about those events, and displays the
27 data in decreasing frequency order, so that the most common events appear
28 first.
29 .sp
30 .LP
31 \fBlockstat\fR gathers data until the specified command completes. For example,
32 to gather statistics for a fixed-time interval, use \fBsleep\fR(1) as the
33 command, as follows:
34 .sp
35 .LP
36 \fBexample#\fR \fBlockstat\fR \fBsleep\fR \fB5\fR
37 .sp
38 .LP
39 When the \fB-I\fR option is specified, \fBlockstat\fR establishes a
40 per-processor high-level periodic interrupt source to gather profiling data.
41 The interrupt handler simply generates a \fBlockstat\fR event whose caller is
42 the interrupted PC (program counter). The profiling event is just like any
43 other \fBlockstat\fR event, so all of the normal \fBlockstat\fR options are
44 applicable.
45 .sp
46 .LP
47 \fBlockstat\fR relies on DTrace to modify the running kernel's text to
48 intercept events of interest. This imposes a small but measurable overhead on
49 all system activity, so access to \fBlockstat\fR is restricted to super-user by
50 default. The system administrator can permit other users to use \fBlockstat\fR
51 by granting them additional DTrace privileges. Refer to the \fIDynamic
52 Tracing Guide\fR for more information about DTrace security features.
53 .SH OPTIONS
54 .LP
55 The following options are supported:
56 .SS "Event Selection"
57 .LP
58 If no event selection options are specified, the default is \fB-C\fR.
59 .sp
60 .ne 2
61 .na
62 \fB\fB-A\fR\fR
63 .ad
64 .sp .6
65 .RS 4n
66 Watch all lock events. \fB-A\fR is equivalent to \fB-CH\fR.
67 .RE
69 .sp
70 .ne 2
71 .na
72 \fB\fB-C\fR\fR
73 .ad
74 .sp .6
75 .RS 4n
76 Watch contention events.
77 .RE
79 .sp
80 .ne 2
81 .na
82 \fB\fB-E\fR\fR
83 .ad
84 .sp .6
85 .RS 4n
86 Watch error events.
87 .RE
89 .sp
90 .ne 2
91 .na
92 \fB\fB\fR\fB-e\fR \fIevent_list\fR\fR
93 .ad
94 .sp .6
95 .RS 4n
96 Only watch the specified events. \fIevent\fR \fIlist\fR is a comma-separated
97 list of events or ranges of events such as 1,4-7,35. Run \fBlockstat\fR with no
98 arguments to get a brief description of all events.
99 .RE
102 .ne 2
104 \fB\fB-H\fR\fR
106 .sp .6
107 .RS 4n
108 Watch hold events.
112 .ne 2
114 \fB\fB-I\fR\fR
116 .sp .6
117 .RS 4n
118 Watch profiling interrupt events.
122 .ne 2
124 \fB\fB\fR\fB-i\fR \fIrate\fR\fR
126 .sp .6
127 .RS 4n
128 Interrupt rate (per second) for \fB-I\fR. The default is 97 Hz, so that
129 profiling doesn't run in lockstep with the clock interrupt (which runs at 100
130 Hz).
133 .SS "Data Gathering"
134 .ne 2
136 \fB\fB-x\fR \fIarg\fR[=\fIval\fR]\fR
138 .sp .6
139 .RS 4n
140 Enable or modify a DTrace runtime option or D compiler option. The list of
141 options is found in the \fI\fR. Boolean options are enabled by specifying their
142 name. Options with values are set by separating the option name and value with
143 an equals sign (=).
146 .SS "Data Gathering (Mutually Exclusive)"
147 .ne 2
149 \fB\fB-b\fR\fR
151 .sp .6
152 .RS 4n
153 Basic statistics: lock, caller, number of events.
157 .ne 2
159 \fB\fB-h\fR\fR
161 .sp .6
162 .RS 4n
163 Histogram: Timing plus time-distribution histograms.
167 .ne 2
169 \fB\fB\fR\fB-s\fR \fIdepth\fR\fR
171 .sp .6
172 .RS 4n
173 Stack trace: Histogram plus stack traces up to \fIdepth\fR frames deep.
177 .ne 2
179 \fB\fB-t\fR\fR
181 .sp .6
182 .RS 4n
183 Timing: Basic plus timing for all events [default].
186 .SS "Data Filtering"
187 .ne 2
189 \fB\fB\fR\fB-d\fR \fIduration\fR\fR
191 .sp .6
192 .RS 4n
193 Only watch events longer than \fIduration\fR.
197 .ne 2
199 \fB\fB\fR\fB-f\fR \fIfunc[,size]\fR\fR
201 .sp .6
202 .RS 4n
203 Only watch events generated by \fIfunc\fR, which can be specified as a symbolic
204 name or hex address. \fIsize\fR defaults to the \fBELF\fR symbol size if
205 available, or \fB1\fR if not.
209 .ne 2
211 \fB\fB\fR\fB-l\fR \fIlock[,size]\fR\fR
213 .sp .6
214 .RS 4n
215 Only watch \fIlock\fR, which can be specified as a symbolic name or hex
216 address. \fBsize\fR defaults to the \fBELF\fR symbol size or \fB1\fR if the
217 symbol size is not available.
221 .ne 2
223 \fB\fB\fR\fB-n\fR \fInrecords\fR\fR
225 .sp .6
226 .RS 4n
227 Maximum number of data records.
231 .ne 2
233 \fB\fB-T\fR\fR
235 .sp .6
236 .RS 4n
237 Trace (rather than sample) events [off by default].
240 .SS "Data Reporting"
241 .ne 2
243 \fB\fB-c\fR\fR
245 .sp .6
246 .RS 4n
247 Coalesce lock data for lock arrays (for example, \fBpse_mutex[]\fR).
251 .ne 2
253 \fB\fB\fR\fB-D\fR \fIcount\fR\fR
255 .sp .6
256 .RS 4n
257 Only display the top \fIcount\fR events of each type.
261 .ne 2
263 \fB\fB-g\fR\fR
265 .sp .6
266 .RS 4n
267 Show total events generated by function. For example, if \fBfoo()\fR calls
268 \fBbar()\fR in a loop, the work done by \fBbar()\fR counts as work generated by
269 \fBfoo()\fR (along with any work done by \fBfoo()\fR itself). The \fB-g\fR
270 option works by counting the total number of stack frames in which each
271 function appears. This implies two things: (1) the data reported by \fB-g\fR
272 can be misleading if the stack traces are not deep enough, and (2) functions
273 that are called recursively might show greater than 100% activity. In light of
274 issue (1), the default data gathering mode when using \fB-g\fR is \fB-s\fR
275 \fB50\fR.
279 .ne 2
281 \fB\fB-k\fR\fR
283 .sp .6
284 .RS 4n
285 Coalesce PCs within functions.
289 .ne 2
291 \fB\fB\fR\fB-o\fR \fIfilename\fR\fR
293 .sp .6
294 .RS 4n
295 Direct output to \fIfilename\fR.
299 .ne 2
301 \fB\fB-P\fR\fR
303 .sp .6
304 .RS 4n
305 Sort data by (\fIcount * time\fR) product.
309 .ne 2
311 \fB\fB-p\fR\fR
313 .sp .6
314 .RS 4n
315 Parsable output format.
319 .ne 2
321 \fB\fB-R\fR\fR
323 .sp .6
324 .RS 4n
325 Display rates (events per second) rather than counts.
329 .ne 2
331 \fB\fB-W\fR\fR
333 .sp .6
334 .RS 4n
335 Whichever: distinguish events only by caller, not by lock.
339 .ne 2
341 \fB\fB-w\fR\fR
343 .sp .6
344 .RS 4n
345 Wherever: distinguish events only by lock, not by caller.
348 .SH DISPLAY FORMATS
350 The following headers appear over various columns of data.
352 .ne 2
354 \fB\fBCount\fR or \fBops/s\fR\fR
356 .sp .6
357 .RS 4n
358 Number of times this event occurred, or the rate (times per second) if \fB-R\fR
359 was specified.
363 .ne 2
365 \fB\fBindv\fR\fR
367 .sp .6
368 .RS 4n
369 Percentage of all events represented by this individual event.
373 .ne 2
375 \fB\fBgenr\fR\fR
377 .sp .6
378 .RS 4n
379 Percentage of all events generated by this function.
383 .ne 2
385 \fB\fBcuml\fR\fR
387 .sp .6
388 .RS 4n
389 Cumulative percentage; a running total of the individuals.
393 .ne 2
395 \fB\fBrcnt\fR\fR
397 .sp .6
398 .RS 4n
399 Average reference count. This will always be \fB1\fR for exclusive locks
400 (mutexes, spin locks, rwlocks held as writer) but can be greater than \fB1\fR
401 for shared locks (rwlocks held as reader).
405 .ne 2
407 \fB\fBnsec\fR\fR
409 .sp .6
410 .RS 4n
411 Average duration of the events in nanoseconds, as appropriate for the event.
412 For the profiling event, duration means interrupt latency.
416 .ne 2
418 \fB\fBLock\fR\fR
420 .sp .6
421 .RS 4n
422 Address of the lock; displayed symbolically if possible.
426 .ne 2
428 \fB\fBCPU+PIL\fR\fR
430 .sp .6
431 .RS 4n
432 \fBCPU\fR plus processor interrupt level (\fBPIL\fR). For example, if \fBCPU\fR
433 4 is interrupted while at \fBPIL\fR 6, this will be reported as \fBcpu[4]+6\fR.
437 .ne 2
439 \fB\fBCaller\fR\fR
441 .sp .6
442 .RS 4n
443 Address of the caller; displayed symbolically if possible.
446 .SH EXAMPLES
448 \fBExample 1 \fRMeasuring Kernel Lock Contention
450 .in +2
452 example# \fBlockstat sleep 5\fR
453 Adaptive mutex spin: 2210 events in 5.055 seconds (437 events/sec)
455 .in -2
459 .in +2
461 Count indv cuml rcnt     nsec Lock                Caller
462 ------------------------------------------------------------------------
463   269  12%  12% 1.00     2160 service_queue       background+0xdc
464   249  11%  23% 1.00       86 service_queue       qenable_locked+0x64
465   228  10%  34% 1.00      131 service_queue       background+0x15c
466    68   3%  37% 1.00       79 0x30000024070       untimeout+0x1c
467    59   3%  40% 1.00      384 0x300066fa8e0       background+0xb0
468    43   2%  41% 1.00       30 rqcred_lock         svc_getreq+0x3c
469    42   2%  43% 1.00      341 0x30006834eb8       background+0xb0
470    41   2%  45% 1.00      135 0x30000021058       untimeout+0x1c
471    40   2%  47% 1.00       39 rqcred_lock         svc_getreq+0x260
472    37   2%  49% 1.00     2372 0x300068e83d0       hmestart+0x1c4
473    36   2%  50% 1.00       77 0x30000021058       timeout_common+0x4
474    36   2%  52% 1.00      354 0x300066fa120       background+0xb0
475    32   1%  53% 1.00       97 0x30000024070       timeout_common+0x4
476    31   1%  55% 1.00     2923 0x300069883d0       hmestart+0x1c4
477    29   1%  56% 1.00      366 0x300066fb290       background+0xb0
478    28   1%  57% 1.00      117 0x3000001e040       untimeout+0x1c
479    25   1%  59% 1.00       93 0x3000001e040       timeout_common+0x4
480    22   1%  60% 1.00       25 0x30005161110       sync_stream_buf+0xdc
481    21   1%  60% 1.00      291 0x30006834eb8       putq+0xa4
482    19   1%  61% 1.00       43 0x3000515dcb0       mdf_alloc+0xc
483    18   1%  62% 1.00      456 0x30006834eb8       qenable+0x8
484    18   1%  63% 1.00       61 service_queue       queuerun+0x168
485    17   1%  64% 1.00      268 0x30005418ee8       vmem_free+0x3c
486 [...]
488 R/W reader blocked by writer: 76 events in 5.055 seconds (15 events/sec)
490 Count indv cuml rcnt     nsec Lock                Caller
491 ------------------------------------------------------------------------
492    23  30%  30% 1.00 22590137 0x300098ba358       ufs_dirlook+0xd0
493    17  22%  53% 1.00  5820995 0x3000ad815e8       find_bp+0x10
494    13  17%  70% 1.00  2639918 0x300098ba360       ufs_iget+0x198
495     4   5%  75% 1.00  3193015 0x300098ba360       ufs_getattr+0x54
496     3   4%  79% 1.00  7953418 0x3000ad817c0       find_bp+0x10
497     3   4%  83% 1.00   935211 0x3000ad815e8       find_read_lof+0x14
498     2   3%  86% 1.00 16357310 0x300073a4720       find_bp+0x10
499     2   3%  88% 1.00  2072433 0x300073a4720       find_read_lof+0x14
500     2   3%  91% 1.00  1606153 0x300073a4370       find_bp+0x10
501     1   1%  92% 1.00  2656909 0x300107e7400       ufs_iget+0x198
502 [...]
504 .in -2
508 \fBExample 2 \fRMeasuring Hold Times
510 .in +2
512 example# \fBlockstat -H -D 10 sleep 1\fR
513 Adaptive mutex spin: 513 events
515 .in -2
519 .in +2
521 Count indv cuml rcnt     nsec Lock                Caller
522 -------------------------------------------------------------------------
523   480   5%   5% 1.00     1136 0x300007718e8       putnext+0x40
524   286   3%   9% 1.00      666 0x3000077b430       getf+0xd8
525   271   3%  12% 1.00      537 0x3000077b430       msgio32+0x2fc
526   270   3%  15% 1.00     3670 0x300007718e8       strgetmsg+0x3d4
527   270   3%  18% 1.00     1016 0x300007c38b0       getq_noenab+0x200
528   264   3%  20% 1.00     1649 0x300007718e8       strgetmsg+0xa70
529   216   2%  23% 1.00     6251 tcp_mi_lock         tcp_snmp_get+0xfc
530   206   2%  25% 1.00      602 thread_free_lock    clock+0x250
531   138   2%  27% 1.00      485 0x300007c3998       putnext+0xb8
532   138   2%  28% 1.00     3706 0x300007718e8       strrput+0x5b8
533 -------------------------------------------------------------------------
534 [...]
536 .in -2
540 \fBExample 3 \fRMeasuring Hold Times for Stack Traces Containing a Specific
541 Function
543 .in +2
545 example# \fBlockstat -H -f tcp_rput_data -s 50 -D 10 sleep 1\fR
546 Adaptive mutex spin: 11 events in 1.023 seconds (11
547 events/sec)
549 .in -2
553 .in +2
555 -------------------------------------------------------------------------
556 Count indv cuml rcnt     nsec Lock                   Caller
557     9  82%  82% 1.00     2540 0x30000031380          tcp_rput_data+0x2b90
559       nsec ------ Time Distribution ------ count     Stack
560        256 |@@@@@@@@@@@@@@@@               5         tcp_rput_data+0x2b90
561        512 |@@@@@@                         2         putnext+0x78
562       1024 |@@@                            1         ip_rput+0xec4
563       2048 |                               0         _c_putnext+0x148
564       4096 |                               0         hmeread+0x31c
565       8192 |                               0         hmeintr+0x36c
566      16384 |@@@                            1
567 sbus_intr_wrapper+0x30
568 [...]
570 Count indv cuml rcnt     nsec Lock                   Caller
571     1   9%  91% 1.00     1036 0x30000055380          freemsg+0x44
573       nsec ------ Time Distribution ------ count     Stack
574       1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1         freemsg+0x44
575                                                      tcp_rput_data+0x2fd0
576                                                      putnext+0x78
577                                                      ip_rput+0xec4
578                                                      _c_putnext+0x148
579                                                      hmeread+0x31c
580                                                      hmeintr+0x36c
582 sbus_intr_wrapper+0x30
583 -------------------------------------------------------------------------
584 [...]
586 .in -2
590 \fBExample 4 \fRBasic Kernel Profiling
593 For basic profiling, we don't care whether the profiling interrupt sampled
594 \fBfoo()\fR\fB+0x4c\fR or \fBfoo()\fR\fB+0x78\fR; we care only that it sampled
595 somewhere in \fBfoo()\fR, so we use \fB-k\fR. The \fBCPU\fR and \fBPIL\fR
596 aren't relevant to basic profiling because we are measuring the system as a
597 whole, not a particular \fBCPU\fR or interrupt level, so we use \fB-W\fR.
600 .in +2
602 example# \fBlockstat -kIW -D 20 ./polltest\fR
603 Profiling interrupt: 82 events in 0.424 seconds (194
604 events/sec)
606 .in -2
610 .in +2
612 Count indv cuml rcnt     nsec Hottest CPU+PIL     Caller
613 -----------------------------------------------------------------------
614     8  10%  10% 1.00      698 cpu[1]              utl0
615     6   7%  17% 1.00      299 cpu[0]              read
616     5   6%  23% 1.00      124 cpu[1]              getf
617     4   5%  28% 1.00      327 cpu[0]              fifo_read
618     4   5%  33% 1.00      112 cpu[1]              poll
619     4   5%  38% 1.00      212 cpu[1]              uiomove
620     4   5%  43% 1.00      361 cpu[1]              mutex_tryenter
621     3   4%  46% 1.00      682 cpu[0]              write
622     3   4%  50% 1.00       89 cpu[0]              pcache_poll
623     3   4%  54% 1.00      118 cpu[1]              set_active_fd
624     3   4%  57% 1.00      105 cpu[0]              syscall_trap32
625     3   4%  61% 1.00      640 cpu[1]              (usermode)
626     2   2%  63% 1.00      127 cpu[1]              fifo_poll
627     2   2%  66% 1.00      300 cpu[1]              fifo_write
628     2   2%  68% 1.00      669 cpu[0]              releasef
629     2   2%  71% 1.00      112 cpu[1]              bt_getlowbit
630     2   2%  73% 1.00      247 cpu[1]              splx
631     2   2%  76% 1.00      503 cpu[0]              mutex_enter
632     2   2%  78% 1.00      467 cpu[0]+10           disp_lock_enter
633     2   2%  80% 1.00      139 cpu[1]              default_copyin
634 -----------------------------------------------------------------------
635 [...]
637 .in -2
641 \fBExample 5 \fRGenerated-load Profiling
644 In the example above, 5% of the samples were in \fBpoll()\fR. This tells us how
645 much time was spent inside \fBpoll()\fR itself, but tells us nothing about how
646 much work was \fBgenerated\fR by \fBpoll()\fR; that is, how much time we spent
647 in functions called by \fBpoll()\fR. To determine that, we use the \fB-g\fR
648 option. The example below shows that although \fBpolltest\fR spends only 5% of
649 its time in \fBpoll()\fR itself, \fBpoll()\fR-induced work accounts for 34% of
650 the load.
654 Note that the functions that generate the profiling interrupt
655 (\fBlockstat_intr()\fR, \fBcyclic_fire()\fR, and so forth) appear in every
656 stack trace, and therefore are considered to have generated 100% of the load.
657 This illustrates an important point: the generated load percentages do
658 \fBnot\fR add up to 100% because they are not independent. If 72% of all stack
659 traces contain both \fBfoo()\fR and \fBbar()\fR, then both \fBfoo()\fR and
660 \fBbar()\fR are 72% load generators.
663 .in +2
665 example# \fBlockstat -kgIW -D 20 ./polltest\fR
666 Profiling interrupt: 80 events in 0.412 seconds (194 events/sec)
668 .in -2
672 .in +2
674 Count genr cuml rcnt     nsec Hottest CPU+PIL     Caller
675 -------------------------------------------------------------------------
676    80 100% ---- 1.00      310 cpu[1]              lockstat_intr
677    80 100% ---- 1.00      310 cpu[1]              cyclic_fire
678    80 100% ---- 1.00      310 cpu[1]              cbe_level14
679    80 100% ---- 1.00      310 cpu[1]              current_thread
680    27  34% ---- 1.00      176 cpu[1]              poll
681    20  25% ---- 1.00      221 cpu[0]              write
682    19  24% ---- 1.00      249 cpu[1]              read
683    17  21% ---- 1.00      232 cpu[0]              write32
684    17  21% ---- 1.00      207 cpu[1]              pcache_poll
685    14  18% ---- 1.00      319 cpu[0]              fifo_write
686    13  16% ---- 1.00      214 cpu[1]              read32
687    10  12% ---- 1.00      208 cpu[1]              fifo_read
688    10  12% ---- 1.00      787 cpu[1]              utl0
689     9  11% ---- 1.00      178 cpu[0]              pcacheset_resolve
690     9  11% ---- 1.00      262 cpu[0]              uiomove
691     7   9% ---- 1.00      506 cpu[1]              (usermode)
692     5   6% ---- 1.00      195 cpu[1]              fifo_poll
693     5   6% ---- 1.00      136 cpu[1]              syscall_trap32
694     4   5% ---- 1.00      139 cpu[0]              releasef
695     3   4% ---- 1.00      277 cpu[1]              polllock
696 -------------------------------------------------------------------------
697 [...]
699 .in -2
703 \fBExample 6 \fRGathering Lock Contention and Profiling Data for a Specific
704 Module
707 In this example we use the \fB-f\fR option not to specify a single function,
708 but rather to specify the entire text space of the \fBsbus\fR module. We gather
709 both lock contention and profiling statistics so that contention can be
710 correlated with overall load on the module.
713 .in +2
715 example# \fBmodinfo | grep sbus\fR
716  24 102a8b6f   b8b4  59   1  sbus (SBus (sysio) nexus driver)
718 .in -2
722 .in +2
724 example# \fBlockstat -kICE -f 0x102a8b6f,0xb8b4 sleep 10\fR
725 Adaptive mutex spin: 39 events in 10.042 seconds (4 events/sec)
727 .in -2
731 .in +2
733 Count indv cuml rcnt     nsec Lock               Caller
734 -------------------------------------------------------------------------
735    15  38%  38% 1.00      206 0x30005160528      sync_stream_buf
736     7  18%  56% 1.00       14 0x30005160d18      sync_stream_buf
737     6  15%  72% 1.00       27 0x300060c3118      sync_stream_buf
738     5  13%  85% 1.00       24 0x300060c3510      sync_stream_buf
739     2   5%  90% 1.00       29 0x300060c2d20      sync_stream_buf
740     2   5%  95% 1.00       24 0x30005161cf8      sync_stream_buf
741     1   3%  97% 1.00       21 0x30005161110      sync_stream_buf
742     1   3% 100% 1.00       23 0x30005160130      sync_stream_buf
743 [...]
745 Adaptive mutex block: 9 events in 10.042 seconds (1 events/sec)
747 Count indv cuml rcnt     nsec Lock               Caller
748 -------------------------------------------------------------------------
749     4  44%  44% 1.00   156539 0x30005160528      sync_stream_buf
750     2  22%  67% 1.00   763516 0x30005160d18      sync_stream_buf
751     1  11%  78% 1.00   462130 0x300060c3510      sync_stream_buf
752     1  11%  89% 1.00   288749 0x30005161110      sync_stream_buf
753     1  11% 100% 1.00  1015374 0x30005160130      sync_stream_buf
754 [...]
756 Profiling interrupt: 229 events in 10.042 seconds (23 events/sec)
758 Count indv cuml rcnt     nsec Hottest CPU+PIL    Caller
760 -------------------------------------------------------------------------
761    89  39%  39% 1.00      426 cpu[0]+6           sync_stream_buf
762    64  28%  67% 1.00      398 cpu[0]+6           sbus_intr_wrapper
763    23  10%  77% 1.00      324 cpu[0]+6           iommu_dvma_kaddr_load
764    21   9%  86% 1.00      512 cpu[0]+6           iommu_tlb_flush
765    14   6%  92% 1.00      342 cpu[0]+6           iommu_dvma_unload
766    13   6%  98% 1.00      306 cpu[1]             iommu_dvma_sync
767     5   2% 100% 1.00      389 cpu[1]             iommu_dma_bindhdl
768 -------------------------------------------------------------------------
769 [...]
771 .in -2
775 \fBExample 7 \fRDetermining the Average PIL (processor interrupt level) for a
778 .in +2
780 example# \fBlockstat -Iw -l cpu[3] ./testprog\fR
782 Profiling interrupt: 14791 events in 152.463 seconds (97 events/sec)
784 Count indv cuml rcnt     nsec CPU+PIL             Hottest Caller
786 -----------------------------------------------------------------------
787 13641  92%  92% 1.00      253 cpu[3]              (usermode)
788   579   4%  96% 1.00      325 cpu[3]+6            ip_ocsum+0xe8
789   375   3%  99% 1.00      411 cpu[3]+10           splx
790   154   1% 100% 1.00      527 cpu[3]+4            fas_intr_svc+0x80
791    41   0% 100% 1.00      293 cpu[3]+13           send_mondo+0x18
792     1   0% 100% 1.00      266 cpu[3]+12           zsa_rxint+0x400
793 -----------------------------------------------------------------------
794 [...]
796 .in -2
800 \fBExample 8 \fRDetermining which Subsystem is Causing the System to be Busy
802 .in +2
804 example# \fBlockstat -s 10 -I sleep 20\fR
806 Profiling interrupt: 4863 events in 47.375 seconds (103 events/sec)
808 Count indv cuml rcnt     nsec CPU+PIL          Caller
810 -----------------------------------------------------------------------
811 1929   40%  40% 0.00     3215 cpu[0]           usec_delay+0x78
812   nsec ------ Time Distribution ------ count   Stack
813   4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  1872    ata_wait+0x90
814   8192 |                               27      acersb_get_intr_status+0x34
815  16384 |                               29      ata_set_feature+0x124
816  32768 |                               1       ata_disk_start+0x15c
817                                                ata_hba_start+0xbc
818                                                ghd_waitq_process_and \e
819                                                _mutex_hold+0x70
820                                                ghd_waitq_process_and \e
821                                                _mutex_exit+0x4
822                                                ghd_transport+0x12c
823                                                ata_disk_tran_start+0x108
824 -----------------------------------------------------------------------
825 [...]
827 .in -2
830 .SH SEE ALSO
832 \fBdtrace\fR(1M), \fBplockstat\fR(1M), \fBattributes\fR(5), \fBlockstat\fR(7D),
833 \fBmutex\fR(9F), \fBrwlock\fR(9F)
836 \fIDynamic Tracing Guide\fR:
839 https://illumos.org/books/dtrace/
841 .SH NOTES
843 Tail-call elimination can affect call sites. For example, if
844 \fBfoo()\fR\fB+0x50\fR calls \fBbar()\fR and the last thing \fBbar()\fR does is
845 call \fBmutex_exit()\fR, the compiler can arrange for \fBbar()\fR to branch to
846 \fBmutex_exit()\fR with a return address of \fBfoo()\fR\fB+0x58\fR. Thus, the
847 \fBmutex_exit()\fR in \fBbar()\fR will appear as though it occurred at
848 \fBfoo()\fR\fB+0x58\fR.
851 The \fBPC\fR in the stack frame in which an interrupt occurs can be bogus
852 because, between function calls, the compiler is free to use the return address
853 register for local storage.
856 When using the \fB-I\fR and \fB-s\fR options together, the interrupted PC will
857 usually not appear anywhere in the stack since the interrupt handler is entered
858 asynchronously, not by a function call from that \fBPC\fR.
861 The \fBlockstat\fR technology is provided on an as-is basis. The format and
862 content of \fBlockstat\fR output reflect the current kernel
863 implementation and are therefore subject to change in future releases.