6324 Add an `ndp' tool for manipulating the neighbors table
[illumos-gate.git] / usr / src / man / man1m / lockstat.1m
blob8c7eb1749416d532c231db3f61331e6c9a1c445b
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 "Feb 28, 2008"
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 .sp
21 .LP
22 The \fBlockstat\fR utility gathers and displays kernel locking and profiling
23 statistics. \fBlockstat\fR allows you to specify which events to watch (for
24 example, spin on adaptive mutex, block on read access to rwlock due to waiting
25 writers, and so forth) how much data to gather for each event, and how to
26 display the data. By default, \fBlockstat\fR monitors all lock contention
27 events, gathers frequency and timing data about those events, and displays the
28 data in decreasing frequency order, so that the most common events appear
29 first.
30 .sp
31 .LP
32 \fBlockstat\fR gathers data until the specified command completes. For example,
33 to gather statistics for a fixed-time interval, use \fBsleep\fR(1) as the
34 command, as follows:
35 .sp
36 .LP
37 \fBexample#\fR \fBlockstat\fR \fBsleep\fR \fB5\fR
38 .sp
39 .LP
40 When the \fB-I\fR option is specified, \fBlockstat\fR establishes a
41 per-processor high-level periodic interrupt source to gather profiling data.
42 The interrupt handler simply generates a \fBlockstat\fR event whose caller is
43 the interrupted PC (program counter). The profiling event is just like any
44 other \fBlockstat\fR event, so all of the normal \fBlockstat\fR options are
45 applicable.
46 .sp
47 .LP
48 \fBlockstat\fR relies on DTrace to modify the running kernel's text to
49 intercept events of interest. This imposes a small but measurable overhead on
50 all system activity, so access to \fBlockstat\fR is restricted to super-user by
51 default. The system administrator can permit other users to use \fBlockstat\fR
52 by granting them additional DTrace privileges. Refer to the \fISolaris Dynamic
53 Tracing Guide\fR for more information about DTrace security features.
54 .SH OPTIONS
55 .sp
56 .LP
57 The following options are supported:
58 .SS "Event Selection"
59 .sp
60 .LP
61 If no event selection options are specified, the default is \fB-C\fR.
62 .sp
63 .ne 2
64 .na
65 \fB\fB-A\fR\fR
66 .ad
67 .sp .6
68 .RS 4n
69 Watch all lock events. \fB-A\fR is equivalent to \fB-CH\fR.
70 .RE
72 .sp
73 .ne 2
74 .na
75 \fB\fB-C\fR\fR
76 .ad
77 .sp .6
78 .RS 4n
79 Watch contention events.
80 .RE
82 .sp
83 .ne 2
84 .na
85 \fB\fB-E\fR\fR
86 .ad
87 .sp .6
88 .RS 4n
89 Watch error events.
90 .RE
92 .sp
93 .ne 2
94 .na
95 \fB\fB\fR\fB-e\fR \fIevent_list\fR\fR
96 .ad
97 .sp .6
98 .RS 4n
99 Only watch the specified events. \fIevent\fR \fIlist\fR is a comma-separated
100 list of events or ranges of events such as 1,4-7,35. Run \fBlockstat\fR with no
101 arguments to get a brief description of all events.
105 .ne 2
107 \fB\fB-H\fR\fR
109 .sp .6
110 .RS 4n
111 Watch hold events.
115 .ne 2
117 \fB\fB-I\fR\fR
119 .sp .6
120 .RS 4n
121 Watch profiling interrupt events.
125 .ne 2
127 \fB\fB\fR\fB-i\fR \fIrate\fR\fR
129 .sp .6
130 .RS 4n
131 Interrupt rate (per second) for \fB-I\fR. The default is 97 Hz, so that
132 profiling doesn't run in lockstep with the clock interrupt (which runs at 100
133 Hz).
136 .SS "Data Gathering"
138 .ne 2
140 \fB\fB-x\fR \fIarg\fR[=\fIval\fR]\fR
142 .sp .6
143 .RS 4n
144 Enable or modify a DTrace runtime option or D compiler option. The list of
145 options is found in the \fI\fR. Boolean options are enabled by specifying their
146 name. Options with values are set by separating the option name and value with
147 an equals sign (=).
150 .SS "Data Gathering (Mutually Exclusive)"
152 .ne 2
154 \fB\fB-b\fR\fR
156 .sp .6
157 .RS 4n
158 Basic statistics: lock, caller, number of events.
162 .ne 2
164 \fB\fB-h\fR\fR
166 .sp .6
167 .RS 4n
168 Histogram: Timing plus time-distribution histograms.
172 .ne 2
174 \fB\fB\fR\fB-s\fR \fIdepth\fR\fR
176 .sp .6
177 .RS 4n
178 Stack trace: Histogram plus stack traces up to \fIdepth\fR frames deep.
182 .ne 2
184 \fB\fB-t\fR\fR
186 .sp .6
187 .RS 4n
188 Timing: Basic plus timing for all events [default].
191 .SS "Data Filtering"
193 .ne 2
195 \fB\fB\fR\fB-d\fR \fIduration\fR\fR
197 .sp .6
198 .RS 4n
199 Only watch events longer than \fIduration\fR.
203 .ne 2
205 \fB\fB\fR\fB-f\fR \fIfunc[,size]\fR\fR
207 .sp .6
208 .RS 4n
209 Only watch events generated by \fIfunc\fR, which can be specified as a symbolic
210 name or hex address. \fIsize\fR defaults to the \fBELF\fR symbol size if
211 available, or \fB1\fR if not.
215 .ne 2
217 \fB\fB\fR\fB-l\fR \fIlock[,size]\fR\fR
219 .sp .6
220 .RS 4n
221 Only watch \fIlock\fR, which can be specified as a symbolic name or hex
222 address. \fBsize\fR defaults to the \fBELF\fR symbol size or \fB1\fR if the
223 symbol size is not available.
227 .ne 2
229 \fB\fB\fR\fB-n\fR \fInrecords\fR\fR
231 .sp .6
232 .RS 4n
233 Maximum number of data records.
237 .ne 2
239 \fB\fB-T\fR\fR
241 .sp .6
242 .RS 4n
243 Trace (rather than sample) events [off by default].
246 .SS "Data Reporting"
248 .ne 2
250 \fB\fB-c\fR\fR
252 .sp .6
253 .RS 4n
254 Coalesce lock data for lock arrays (for example, \fBpse_mutex[]\fR).
258 .ne 2
260 \fB\fB\fR\fB-D\fR \fIcount\fR\fR
262 .sp .6
263 .RS 4n
264 Only display the top \fIcount\fR events of each type.
268 .ne 2
270 \fB\fB-g\fR\fR
272 .sp .6
273 .RS 4n
274 Show total events generated by function. For example, if \fBfoo()\fR calls
275 \fBbar()\fR in a loop, the work done by \fBbar()\fR counts as work generated by
276 \fBfoo()\fR (along with any work done by \fBfoo()\fR itself). The \fB-g\fR
277 option works by counting the total number of stack frames in which each
278 function appears. This implies two things: (1) the data reported by \fB-g\fR
279 can be misleading if the stack traces are not deep enough, and (2) functions
280 that are called recursively might show greater than 100% activity. In light of
281 issue (1), the default data gathering mode when using \fB-g\fR is \fB-s\fR
282 \fB50\fR.
286 .ne 2
288 \fB\fB-k\fR\fR
290 .sp .6
291 .RS 4n
292 Coalesce PCs within functions.
296 .ne 2
298 \fB\fB\fR\fB-o\fR \fIfilename\fR\fR
300 .sp .6
301 .RS 4n
302 Direct output to \fIfilename\fR.
306 .ne 2
308 \fB\fB-P\fR\fR
310 .sp .6
311 .RS 4n
312 Sort data by (\fIcount * time\fR) product.
316 .ne 2
318 \fB\fB-p\fR\fR
320 .sp .6
321 .RS 4n
322 Parsable output format.
326 .ne 2
328 \fB\fB-R\fR\fR
330 .sp .6
331 .RS 4n
332 Display rates (events per second) rather than counts.
336 .ne 2
338 \fB\fB-W\fR\fR
340 .sp .6
341 .RS 4n
342 Whichever: distinguish events only by caller, not by lock.
346 .ne 2
348 \fB\fB-w\fR\fR
350 .sp .6
351 .RS 4n
352 Wherever: distinguish events only by lock, not by caller.
355 .SH DISPLAY FORMATS
358 The following headers appear over various columns of data.
360 .ne 2
362 \fB\fBCount\fR or \fBops/s\fR\fR
364 .sp .6
365 .RS 4n
366 Number of times this event occurred, or the rate (times per second) if \fB-R\fR
367 was specified.
371 .ne 2
373 \fB\fBindv\fR\fR
375 .sp .6
376 .RS 4n
377 Percentage of all events represented by this individual event.
381 .ne 2
383 \fB\fBgenr\fR\fR
385 .sp .6
386 .RS 4n
387 Percentage of all events generated by this function.
391 .ne 2
393 \fB\fBcuml\fR\fR
395 .sp .6
396 .RS 4n
397 Cumulative percentage; a running total of the individuals.
401 .ne 2
403 \fB\fBrcnt\fR\fR
405 .sp .6
406 .RS 4n
407 Average reference count. This will always be \fB1\fR for exclusive locks
408 (mutexes, spin locks, rwlocks held as writer) but can be greater than \fB1\fR
409 for shared locks (rwlocks held as reader).
413 .ne 2
415 \fB\fBnsec\fR\fR
417 .sp .6
418 .RS 4n
419 Average duration of the events in nanoseconds, as appropriate for the event.
420 For the profiling event, duration means interrupt latency.
424 .ne 2
426 \fB\fBLock\fR\fR
428 .sp .6
429 .RS 4n
430 Address of the lock; displayed symbolically if possible.
434 .ne 2
436 \fB\fBCPU+PIL\fR\fR
438 .sp .6
439 .RS 4n
440 \fBCPU\fR plus processor interrupt level (\fBPIL\fR). For example, if \fBCPU\fR
441 4 is interrupted while at \fBPIL\fR 6, this will be reported as \fBcpu[4]+6\fR.
445 .ne 2
447 \fB\fBCaller\fR\fR
449 .sp .6
450 .RS 4n
451 Address of the caller; displayed symbolically if possible.
454 .SH EXAMPLES
456 \fBExample 1 \fRMeasuring Kernel Lock Contention
458 .in +2
460 example# \fBlockstat sleep 5\fR
461 Adaptive mutex spin: 2210 events in 5.055 seconds (437 events/sec)
463 .in -2
467 .in +2
469 Count indv cuml rcnt     nsec Lock                Caller
470 ------------------------------------------------------------------------
471   269  12%  12% 1.00     2160 service_queue       background+0xdc
472   249  11%  23% 1.00       86 service_queue       qenable_locked+0x64
473   228  10%  34% 1.00      131 service_queue       background+0x15c
474    68   3%  37% 1.00       79 0x30000024070       untimeout+0x1c
475    59   3%  40% 1.00      384 0x300066fa8e0       background+0xb0
476    43   2%  41% 1.00       30 rqcred_lock         svc_getreq+0x3c
477    42   2%  43% 1.00      341 0x30006834eb8       background+0xb0
478    41   2%  45% 1.00      135 0x30000021058       untimeout+0x1c
479    40   2%  47% 1.00       39 rqcred_lock         svc_getreq+0x260
480    37   2%  49% 1.00     2372 0x300068e83d0       hmestart+0x1c4
481    36   2%  50% 1.00       77 0x30000021058       timeout_common+0x4
482    36   2%  52% 1.00      354 0x300066fa120       background+0xb0
483    32   1%  53% 1.00       97 0x30000024070       timeout_common+0x4
484    31   1%  55% 1.00     2923 0x300069883d0       hmestart+0x1c4
485    29   1%  56% 1.00      366 0x300066fb290       background+0xb0
486    28   1%  57% 1.00      117 0x3000001e040       untimeout+0x1c
487    25   1%  59% 1.00       93 0x3000001e040       timeout_common+0x4
488    22   1%  60% 1.00       25 0x30005161110       sync_stream_buf+0xdc
489    21   1%  60% 1.00      291 0x30006834eb8       putq+0xa4
490    19   1%  61% 1.00       43 0x3000515dcb0       mdf_alloc+0xc
491    18   1%  62% 1.00      456 0x30006834eb8       qenable+0x8
492    18   1%  63% 1.00       61 service_queue       queuerun+0x168
493    17   1%  64% 1.00      268 0x30005418ee8       vmem_free+0x3c
494 [...]
496 R/W reader blocked by writer: 76 events in 5.055 seconds (15 events/sec)
498 Count indv cuml rcnt     nsec Lock                Caller
499 ------------------------------------------------------------------------
500    23  30%  30% 1.00 22590137 0x300098ba358       ufs_dirlook+0xd0
501    17  22%  53% 1.00  5820995 0x3000ad815e8       find_bp+0x10
502    13  17%  70% 1.00  2639918 0x300098ba360       ufs_iget+0x198
503     4   5%  75% 1.00  3193015 0x300098ba360       ufs_getattr+0x54
504     3   4%  79% 1.00  7953418 0x3000ad817c0       find_bp+0x10
505     3   4%  83% 1.00   935211 0x3000ad815e8       find_read_lof+0x14
506     2   3%  86% 1.00 16357310 0x300073a4720       find_bp+0x10
507     2   3%  88% 1.00  2072433 0x300073a4720       find_read_lof+0x14
508     2   3%  91% 1.00  1606153 0x300073a4370       find_bp+0x10
509     1   1%  92% 1.00  2656909 0x300107e7400       ufs_iget+0x198
510 [...]
512 .in -2
516 \fBExample 2 \fRMeasuring Hold Times
518 .in +2
520 example# \fBlockstat -H -D 10 sleep 1\fR
521 Adaptive mutex spin: 513 events
523 .in -2
527 .in +2
529 Count indv cuml rcnt     nsec Lock                Caller
530 -------------------------------------------------------------------------
531   480   5%   5% 1.00     1136 0x300007718e8       putnext+0x40
532   286   3%   9% 1.00      666 0x3000077b430       getf+0xd8
533   271   3%  12% 1.00      537 0x3000077b430       msgio32+0x2fc
534   270   3%  15% 1.00     3670 0x300007718e8       strgetmsg+0x3d4
535   270   3%  18% 1.00     1016 0x300007c38b0       getq_noenab+0x200
536   264   3%  20% 1.00     1649 0x300007718e8       strgetmsg+0xa70
537   216   2%  23% 1.00     6251 tcp_mi_lock         tcp_snmp_get+0xfc
538   206   2%  25% 1.00      602 thread_free_lock    clock+0x250
539   138   2%  27% 1.00      485 0x300007c3998       putnext+0xb8
540   138   2%  28% 1.00     3706 0x300007718e8       strrput+0x5b8
541 -------------------------------------------------------------------------
542 [...]
544 .in -2
548 \fBExample 3 \fRMeasuring Hold Times for Stack Traces Containing a Specific
549 Function
551 .in +2
553 example# \fBlockstat -H -f tcp_rput_data -s 50 -D 10 sleep 1\fR
554 Adaptive mutex spin: 11 events in 1.023 seconds (11
555 events/sec)
557 .in -2
561 .in +2
563 -------------------------------------------------------------------------
564 Count indv cuml rcnt     nsec Lock                   Caller
565     9  82%  82% 1.00     2540 0x30000031380          tcp_rput_data+0x2b90
567       nsec ------ Time Distribution ------ count     Stack
568        256 |@@@@@@@@@@@@@@@@               5         tcp_rput_data+0x2b90
569        512 |@@@@@@                         2         putnext+0x78
570       1024 |@@@                            1         ip_rput+0xec4
571       2048 |                               0         _c_putnext+0x148
572       4096 |                               0         hmeread+0x31c
573       8192 |                               0         hmeintr+0x36c
574      16384 |@@@                            1
575 sbus_intr_wrapper+0x30
576 [...]
578 Count indv cuml rcnt     nsec Lock                   Caller
579     1   9%  91% 1.00     1036 0x30000055380          freemsg+0x44
581       nsec ------ Time Distribution ------ count     Stack
582       1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1         freemsg+0x44
583                                                      tcp_rput_data+0x2fd0
584                                                      putnext+0x78
585                                                      ip_rput+0xec4
586                                                      _c_putnext+0x148
587                                                      hmeread+0x31c
588                                                      hmeintr+0x36c
590 sbus_intr_wrapper+0x30
591 -------------------------------------------------------------------------
592 [...]
594 .in -2
598 \fBExample 4 \fRBasic Kernel Profiling
601 For basic profiling, we don't care whether the profiling interrupt sampled
602 \fBfoo()\fR\fB+0x4c\fR or \fBfoo()\fR\fB+0x78\fR; we care only that it sampled
603 somewhere in \fBfoo()\fR, so we use \fB-k\fR. The \fBCPU\fR and \fBPIL\fR
604 aren't relevant to basic profiling because we are measuring the system as a
605 whole, not a particular \fBCPU\fR or interrupt level, so we use \fB-W\fR.
608 .in +2
610 example# \fBlockstat -kIW -D 20 ./polltest\fR
611 Profiling interrupt: 82 events in 0.424 seconds (194
612 events/sec)
614 .in -2
618 .in +2
620 Count indv cuml rcnt     nsec Hottest CPU+PIL     Caller
621 -----------------------------------------------------------------------
622     8  10%  10% 1.00      698 cpu[1]              utl0
623     6   7%  17% 1.00      299 cpu[0]              read
624     5   6%  23% 1.00      124 cpu[1]              getf
625     4   5%  28% 1.00      327 cpu[0]              fifo_read
626     4   5%  33% 1.00      112 cpu[1]              poll
627     4   5%  38% 1.00      212 cpu[1]              uiomove
628     4   5%  43% 1.00      361 cpu[1]              mutex_tryenter
629     3   4%  46% 1.00      682 cpu[0]              write
630     3   4%  50% 1.00       89 cpu[0]              pcache_poll
631     3   4%  54% 1.00      118 cpu[1]              set_active_fd
632     3   4%  57% 1.00      105 cpu[0]              syscall_trap32
633     3   4%  61% 1.00      640 cpu[1]              (usermode)
634     2   2%  63% 1.00      127 cpu[1]              fifo_poll
635     2   2%  66% 1.00      300 cpu[1]              fifo_write
636     2   2%  68% 1.00      669 cpu[0]              releasef
637     2   2%  71% 1.00      112 cpu[1]              bt_getlowbit
638     2   2%  73% 1.00      247 cpu[1]              splx
639     2   2%  76% 1.00      503 cpu[0]              mutex_enter
640     2   2%  78% 1.00      467 cpu[0]+10           disp_lock_enter
641     2   2%  80% 1.00      139 cpu[1]              default_copyin
642 -----------------------------------------------------------------------
643 [...]
645 .in -2
649 \fBExample 5 \fRGenerated-load Profiling
652 In the example above, 5% of the samples were in \fBpoll()\fR. This tells us how
653 much time was spent inside \fBpoll()\fR itself, but tells us nothing about how
654 much work was \fBgenerated\fR by \fBpoll()\fR; that is, how much time we spent
655 in functions called by \fBpoll()\fR. To determine that, we use the \fB-g\fR
656 option. The example below shows that although \fBpolltest\fR spends only 5% of
657 its time in \fBpoll()\fR itself, \fBpoll()\fR-induced work accounts for 34% of
658 the load.
662 Note that the functions that generate the profiling interrupt
663 (\fBlockstat_intr()\fR, \fBcyclic_fire()\fR, and so forth) appear in every
664 stack trace, and therefore are considered to have generated 100% of the load.
665 This illustrates an important point: the generated load percentages do
666 \fBnot\fR add up to 100% because they are not independent. If 72% of all stack
667 traces contain both \fBfoo()\fR and \fBbar()\fR, then both \fBfoo()\fR and
668 \fBbar()\fR are 72% load generators.
671 .in +2
673 example# \fBlockstat -kgIW -D 20 ./polltest\fR
674 Profiling interrupt: 80 events in 0.412 seconds (194 events/sec)
676 .in -2
680 .in +2
682 Count genr cuml rcnt     nsec Hottest CPU+PIL     Caller
683 -------------------------------------------------------------------------
684    80 100% ---- 1.00      310 cpu[1]              lockstat_intr
685    80 100% ---- 1.00      310 cpu[1]              cyclic_fire
686    80 100% ---- 1.00      310 cpu[1]              cbe_level14
687    80 100% ---- 1.00      310 cpu[1]              current_thread
688    27  34% ---- 1.00      176 cpu[1]              poll
689    20  25% ---- 1.00      221 cpu[0]              write
690    19  24% ---- 1.00      249 cpu[1]              read
691    17  21% ---- 1.00      232 cpu[0]              write32
692    17  21% ---- 1.00      207 cpu[1]              pcache_poll
693    14  18% ---- 1.00      319 cpu[0]              fifo_write
694    13  16% ---- 1.00      214 cpu[1]              read32
695    10  12% ---- 1.00      208 cpu[1]              fifo_read
696    10  12% ---- 1.00      787 cpu[1]              utl0
697     9  11% ---- 1.00      178 cpu[0]              pcacheset_resolve
698     9  11% ---- 1.00      262 cpu[0]              uiomove
699     7   9% ---- 1.00      506 cpu[1]              (usermode)
700     5   6% ---- 1.00      195 cpu[1]              fifo_poll
701     5   6% ---- 1.00      136 cpu[1]              syscall_trap32
702     4   5% ---- 1.00      139 cpu[0]              releasef
703     3   4% ---- 1.00      277 cpu[1]              polllock
704 -------------------------------------------------------------------------
705 [...]
707 .in -2
711 \fBExample 6 \fRGathering Lock Contention and Profiling Data for a Specific
712 Module
715 In this example we use the \fB-f\fR option not to specify a single function,
716 but rather to specify the entire text space of the \fBsbus\fR module. We gather
717 both lock contention and profiling statistics so that contention can be
718 correlated with overall load on the module.
721 .in +2
723 example# \fBmodinfo | grep sbus\fR
724  24 102a8b6f   b8b4  59   1  sbus (SBus (sysio) nexus driver)
726 .in -2
730 .in +2
732 example# \fBlockstat -kICE -f 0x102a8b6f,0xb8b4 sleep 10\fR
733 Adaptive mutex spin: 39 events in 10.042 seconds (4 events/sec)
735 .in -2
739 .in +2
741 Count indv cuml rcnt     nsec Lock               Caller
742 -------------------------------------------------------------------------
743    15  38%  38% 1.00      206 0x30005160528      sync_stream_buf
744     7  18%  56% 1.00       14 0x30005160d18      sync_stream_buf
745     6  15%  72% 1.00       27 0x300060c3118      sync_stream_buf
746     5  13%  85% 1.00       24 0x300060c3510      sync_stream_buf
747     2   5%  90% 1.00       29 0x300060c2d20      sync_stream_buf
748     2   5%  95% 1.00       24 0x30005161cf8      sync_stream_buf
749     1   3%  97% 1.00       21 0x30005161110      sync_stream_buf
750     1   3% 100% 1.00       23 0x30005160130      sync_stream_buf
751 [...]
753 Adaptive mutex block: 9 events in 10.042 seconds (1 events/sec)
755 Count indv cuml rcnt     nsec Lock               Caller
756 -------------------------------------------------------------------------
757     4  44%  44% 1.00   156539 0x30005160528      sync_stream_buf
758     2  22%  67% 1.00   763516 0x30005160d18      sync_stream_buf
759     1  11%  78% 1.00   462130 0x300060c3510      sync_stream_buf
760     1  11%  89% 1.00   288749 0x30005161110      sync_stream_buf
761     1  11% 100% 1.00  1015374 0x30005160130      sync_stream_buf
762 [...]
764 Profiling interrupt: 229 events in 10.042 seconds (23 events/sec)
766 Count indv cuml rcnt     nsec Hottest CPU+PIL    Caller
768 -------------------------------------------------------------------------
769    89  39%  39% 1.00      426 cpu[0]+6           sync_stream_buf
770    64  28%  67% 1.00      398 cpu[0]+6           sbus_intr_wrapper
771    23  10%  77% 1.00      324 cpu[0]+6           iommu_dvma_kaddr_load
772    21   9%  86% 1.00      512 cpu[0]+6           iommu_tlb_flush
773    14   6%  92% 1.00      342 cpu[0]+6           iommu_dvma_unload
774    13   6%  98% 1.00      306 cpu[1]             iommu_dvma_sync
775     5   2% 100% 1.00      389 cpu[1]             iommu_dma_bindhdl
776 -------------------------------------------------------------------------
777 [...]
779 .in -2
783 \fBExample 7 \fRDetermining the Average PIL (processor interrupt level) for a
786 .in +2
788 example# \fBlockstat -Iw -l cpu[3] ./testprog\fR
790 Profiling interrupt: 14791 events in 152.463 seconds (97 events/sec)
792 Count indv cuml rcnt     nsec CPU+PIL             Hottest Caller
794 -----------------------------------------------------------------------
795 13641  92%  92% 1.00      253 cpu[3]              (usermode)
796   579   4%  96% 1.00      325 cpu[3]+6            ip_ocsum+0xe8
797   375   3%  99% 1.00      411 cpu[3]+10           splx
798   154   1% 100% 1.00      527 cpu[3]+4            fas_intr_svc+0x80
799    41   0% 100% 1.00      293 cpu[3]+13           send_mondo+0x18
800     1   0% 100% 1.00      266 cpu[3]+12           zsa_rxint+0x400
801 -----------------------------------------------------------------------
802 [...]
804 .in -2
808 \fBExample 8 \fRDetermining which Subsystem is Causing the System to be Busy
810 .in +2
812 example# \fBlockstat -s 10 -I sleep 20\fR
814 Profiling interrupt: 4863 events in 47.375 seconds (103 events/sec)
816 Count indv cuml rcnt     nsec CPU+PIL          Caller
818 -----------------------------------------------------------------------
819 1929   40%  40% 0.00     3215 cpu[0]           usec_delay+0x78
820   nsec ------ Time Distribution ------ count   Stack
821   4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  1872    ata_wait+0x90
822   8192 |                               27      acersb_get_intr_status+0x34
823  16384 |                               29      ata_set_feature+0x124
824  32768 |                               1       ata_disk_start+0x15c
825                                                ata_hba_start+0xbc
826                                                ghd_waitq_process_and \e
827                                                _mutex_hold+0x70
828                                                ghd_waitq_process_and \e
829                                                _mutex_exit+0x4
830                                                ghd_transport+0x12c
831                                                ata_disk_tran_start+0x108
832 -----------------------------------------------------------------------
833 [...]
835 .in -2
838 .SH SEE ALSO
841 \fBdtrace\fR(1M), \fBplockstat\fR(1M), \fBattributes\fR(5), \fBlockstat\fR(7D),
842 \fBmutex\fR(9F), \fBrwlock\fR(9F)
845 \fISolaris Dynamic Tracing Guide\fR
846 .SH NOTES
849 The profiling support provided by \fBlockstat\fR \fB-I\fR replaces the old (and
850 undocumented) \fB/usr/bin/kgmon\fR and \fB/dev/profile\fR.
853 Tail-call elimination can affect call sites. For example, if
854 \fBfoo()\fR\fB+0x50\fR calls \fBbar()\fR and the last thing \fBbar()\fR does is
855 call \fBmutex_exit()\fR, the compiler can arrange for \fBbar()\fR to branch to
856 \fBmutex_exit()\fRwith a return address of \fBfoo()\fR\fB+0x58\fR. Thus, the
857 \fBmutex_exit()\fR in \fBbar()\fR will appear as though it occurred at
858 \fBfoo()\fR\fB+0x58\fR.
861 The \fBPC\fR in the stack frame in which an interrupt occurs can be bogus
862 because, between function calls, the compiler is free to use the return address
863 register for local storage.
866 When using the \fB-I\fR and \fB-s\fR options together, the interrupted PC will
867 usually not appear anywhere in the stack since the interrupt handler is entered
868 asynchronously, not by a function call from that \fBPC\fR.
871 The \fBlockstat\fR technology is provided on an as-is basis. The format and
872 content of \fBlockstat\fR output reflect the current Solaris kernel
873 implementation and are therefore subject to change in future releases.