diff options
author | Martin Matuska <mm@FreeBSD.org> | 2012-07-01 07:53:50 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2012-07-01 07:53:50 +0000 |
commit | d23f7505a7c72baf56372e2812a5c4ee1395d5ec (patch) | |
tree | 1fd268b80600a0c2535f83231729986adc170237 /man | |
parent | 14f45a64f36b90d7b659e601aa70fe732fea3151 (diff) |
Notes
Diffstat (limited to 'man')
-rw-r--r-- | man/man1m/dtrace.1m | 768 | ||||
-rw-r--r-- | man/man1m/lockstat.1m | 873 | ||||
-rw-r--r-- | man/man1m/plockstat.1m | 238 |
3 files changed, 1879 insertions, 0 deletions
diff --git a/man/man1m/dtrace.1m b/man/man1m/dtrace.1m new file mode 100644 index 0000000000000..fc71612e0f1ab --- /dev/null +++ b/man/man1m/dtrace.1m @@ -0,0 +1,768 @@ +'\" te +.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" 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. 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. 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] +.TH DTRACE 1M "Aug 4, 2009" +.SH NAME +dtrace \- DTrace dynamic tracing compiler and tracing utility +.SH SYNOPSIS +.LP +.nf +\fBdtrace\fR [\fB-32\fR | \fB-64\fR] [\fB-aACeFGHhlqSvVwZ\fR] [\fB-b\fR \fIbufsz\fR] [\fB-c\fR \fIcmd\fR] + [\fB-D\fR \fIname\fR [\fI=value\fR]] [\fB-I\fR \fIpath\fR] [\fB-L\fR \fIpath\fR] [\fB-o\fR \fIoutput\fR] + [\fB-s\fR \fIscript\fR] [\fB-U\fR \fIname\fR] [\fB-x\fR \fIarg\fR [\fI=val\fR]] + [\fB-X\fR a | c | s | t] [\fB-p\fR \fIpid\fR] + [\fB-P\fR \fIprovider\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-m\fR [\fIprovider:\fR] \fImodule\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-f\fR [[\fIprovider:\fR] \fImodule:\fR] \fIfunction\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]] + [\fB-i\fR \fIprobe-id\fR [[\fIpredicate\fR] \fIaction\fR]] +.fi + +.SH DESCRIPTION +.sp +.LP +DTrace is a comprehensive dynamic tracing framework for the Solaris Operating +System. DTrace provides a powerful infrastructure that permits administrators, +developers, and service personnel to concisely answer arbitrary questions about +the behavior of the operating system and user programs. +.sp +.LP +The \fISolaris Dynamic Tracing Guide\fR describes how to use DTrace to observe, +debug, and tune system behavior. Refer to this book for a detailed description +of DTrace features, including the bundled DTrace observability tools, +instrumentation providers, and the D programming language. +.sp +.LP +The \fBdtrace\fR command provides a generic interface to the essential services +provided by the DTrace facility, including: +.RS +4 +.TP +.ie t \(bu +.el o +Options that list the set of probes and providers currently published by DTrace +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that enable probes directly using any of the probe description +specifiers (provider, module, function, name) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that run the D compiler and compile one or more D program files or +programs written directly on the command line +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that generate anonymous tracing programs +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that generate program stability reports +.RE +.RS +4 +.TP +.ie t \(bu +.el o +Options that modify DTrace tracing and buffering behavior and enable additional +D compiler features +.RE +.sp +.LP +You can use \fBdtrace\fR to create D scripts by using it in a \fB#!\fR +declaration to create an interpreter file. You can also use \fBdtrace\fR to +attempt to compile D programs and determine their properties without actually +enabling tracing using the \fB-e\fR option. See \fBOPTIONS\fR. See the +\fISolaris Dynamic Tracing Guide\fR for detailed examples of how to use the +\fBdtrace\fR utility to perform these tasks. +.SH OPTIONS +.sp +.LP +The arguments accepted by the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, and +\fB-i\fR options can include an optional D language \fIpredicate\fR enclosed in +slashes \fB//\fR and optional D language \fIaction\fR statement list enclosed +in braces \fB{}\fR. D program code specified on the command line must be +appropriately quoted to avoid interpretation of meta-characters by the shell. +.sp +.LP +The following options are supported: +.sp +.ne 2 +.na +\fB\fB-32\fR | \fB-64\fR\fR +.ad +.sp .6 +.RS 4n +The D compiler produces programs using the native data model of the operating +system kernel. You can use the \fBisainfo\fR \fB-b\fR command to determine the +current operating system data model. If the \fB-32\fR option is specified, +\fBdtrace\fR forces the D compiler to compile a D program using the 32-bit data +model. If the \fB-64\fR option is specified, \fBdtrace\fR forces the D compiler +to compile a D program using the 64-bit data model. These options are typically +not required as \fBdtrace\fR selects the native data model as the default. The +data model affects the sizes of integer types and other language properties. D +programs compiled for either data model can be executed on both 32-bit and +64-bit kernels. The \fB-32\fR and \fB-64\fR options also determine the ELF file +format (ELF32 or ELF64) produced by the \fB-G\fR option. +.RE + +.sp +.ne 2 +.na +\fB\fB-a\fR\fR +.ad +.sp .6 +.RS 4n +Claim anonymous tracing state and display the traced data. You can combine the +\fB-a\fR option with the \fB-e\fR option to force \fBdtrace\fR to exit +immediately after consuming the anonymous tracing state rather than continuing +to wait for new data. See the \fISolaris Dynamic Tracing Guide\fR for more +information about anonymous tracing. +.RE + +.sp +.ne 2 +.na +\fB\fB-A\fR\fR +.ad +.sp .6 +.RS 4n +Generate \fBdriver.conf\fR(4) directives for anonymous tracing. This option +constructs a set of \fBdtrace\fR(7D) configuration file directives to enable +the specified probes for anonymous tracing and then exits. By default, +\fBdtrace\fR attempts to store the directives to the file +\fB/kernel/drv/dtrace.conf\fR. You can modify this behavior if you use the +\fB-o\fR option to specify an alternate output file. +.RE + +.sp +.ne 2 +.na +\fB\fB-b\fR \fIbufsz\fR\fR +.ad +.sp .6 +.RS 4n +Set principal trace buffer size (\fIbufsz\fR). The trace buffer size can +include any of the size suffixes \fBk\fR, \fBm\fR, \fBg\fR, or \fBt\fR. If the +buffer space cannot be allocated, \fBdtrace\fR attempts to reduce the buffer +size or exit depending on the setting of the \fBbufresize\fR property. +.RE + +.sp +.ne 2 +.na +\fB\fB-c\fR \fIcmd\fR\fR +.ad +.sp .6 +.RS 4n +Run the specified command \fIcmd\fR and exit upon its completion. If more than +one \fB-c\fR option is present on the command line, \fBdtrace\fR exits when all +commands have exited, reporting the exit status for each child process as it +terminates. The process-ID of the first command is made available to any D +programs specified on the command line or using the \fB-s\fR option through the +\fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR +for more information on macro variables. +.RE + +.sp +.ne 2 +.na +\fB\fB-C\fR\fR +.ad +.sp .6 +.RS 4n +Run the C preprocessor \fBcpp\fR(1) over D programs before compiling them. You +can pass options to the C preprocessor using the \fB-D\fR, \fB-U\fR, \fB-I\fR, +and \fB-H\fR options. You can select the degree of C standard conformance if +you use the \fB-X\fR option. For a description of the set of tokens defined by +the D compiler when invoking the C preprocessor, see \fB-X\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-D\fR \fIname\fR \fB[=\fR\fIvalue\fR\fB]\fR\fR +.ad +.sp .6 +.RS 4n +Define \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR +option). If you specify the equals sign (\fB=\fR) and additional \fIvalue\fR, +the name is assigned the corresponding value. This option passes the \fB-D\fR +option to each \fBcpp\fR invocation. +.RE + +.sp +.ne 2 +.na +\fB\fB-e\fR\fR +.ad +.sp .6 +.RS 4n +Exit after compiling any requests and consuming anonymous tracing state +(\fB-a\fR option) but prior to enabling any probes. You can combine this option +with the \fB-a\fR option to print anonymous tracing data and exit. You can also +combine this option with D compiler options. This combination verifies that the +programs compile without actually executing them and enabling the corresponding +instrumentation. +.RE + +.sp +.ne 2 +.na +\fB\fB-f\fR\fB[[\fR\fIprovider\fR\fB:]\fR\fImodule\fR\fB:]\fR\fIfunction\fR\fB[ +[\fR\fIpredicate\fR\fB]\fR\fIaction\fR\fB]]\fR\fR +.ad +.sp .6 +.RS 4n +Specify function name to trace or list (\fB-l\fR option). The corresponding +argument can include any of the probe description forms +\fIprovider:module:function\fR, \fImodule:function\fR, or \fIfunction\fR. +Unspecified probe description fields are left blank and match any probes +regardless of the values in those fields. If no qualifiers other than +\fIfunction\fR are specified in the description, all probes with the +corresponding \fIfunction\fR are matched. The \fB-f\fR argument can be suffixed +with an optional D probe clause. You can specify more than one \fB-f\fR option +on the command line at a time. +.RE + +.sp +.ne 2 +.na +\fB\fB-F\fR\fR +.ad +.sp .6 +.RS 4n +Coalesce trace output by identifying function entry and return. Function entry +probe reports are indented and their output is prefixed with \fB->\fR. Function +return probe reports are unindented and their output is prefixed with +\fB<-\fR\&. System call entry probe reports are indented and their output is +prefixed with \fB=>\fR. System call return probe reports are unindented and +their output is prefixed with \fB<=\fR\&. +.RE + +.sp +.ne 2 +.na +\fB\fB-G\fR\fR +.ad +.sp .6 +.RS 4n +Generate an ELF file containing an embedded DTrace program. The DTrace probes +specified in the program are saved inside of a relocatable ELF object which can +be linked into another program. If the \fB-o\fR option is present, the ELF file +is saved using the pathname specified as the argument for this operand. If the +\fB-o\fR option is not present and the DTrace program is contained with a file +whose name is \fB\fIfilename\fR.d\fR, then the ELF file is saved using the name +\fB\fIfilename\fR.o\fR. Otherwise the ELF file is saved using the name +\fBd.out\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-H\fR\fR +.ad +.sp .6 +.RS 4n +Print the pathnames of included files when invoking \fBcpp\fR(1) (enabled using +the \fB-C\fR option). This option passes the \fB-H\fR option to each \fBcpp\fR +invocation, causing it to display the list of pathnames, one for each line, to +\fBstderr\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-h\fR\fR +.ad +.sp .6 +.RS 4n +Generate a header file containing macros that correspond to probes in the +specified provider definitions. This option should be used to generate a header +file that is included by other source files for later use with the \fB-G\fR +option. If the \fB-o\fR option is present, the header file is saved using the +pathname specified as the argument for that option. If the \fB-o\fR option is +not present and the DTrace program is contained with a file whose name is +\fIfilename\fR\fB\&.d\fR, then the header file is saved using the name +\fIfilename\fR\fB\&.h\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-i\fR \fIprobe-id\fR\fB[[\fR\fIpredicate\fR] \fIaction\fR\fB]\fR\fR +.ad +.sp .6 +.RS 4n +Specify probe identifier (\fIprobe-id\fR) to trace or list (\fB-l\fR option). +You can specify probe IDs using decimal integers as shown by \fBdtrace\fR +\fB-l\fR. The \fB-i\fR argument can be suffixed with an optional D probe +clause. You can specify more than one \fB-i\fR option at a time. +.RE + +.sp +.ne 2 +.na +\fB\fB-I\fR \fIpath\fR\fR +.ad +.sp .6 +.RS 4n +Add the specified directory \fIpath\fR to the search path for \fB#include\fR +files when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This +option passes the \fB-I\fR option to each \fBcpp\fR invocation. The specified +\fIpath\fR is inserted into the search path ahead of the default directory +list. +.RE + +.sp +.ne 2 +.na +\fB\fB-L\fR \fIpath\fR\fR +.ad +.sp .6 +.RS 4n +Add the specified directory \fIpath\fR to the search path for DTrace libraries. +DTrace libraries are used to contain common definitions that can be used when +writing D programs. The specified \fIpath\fR is added after the default library +search path. +.RE + +.sp +.ne 2 +.na +\fB\fB-l\fR\fR +.ad +.sp .6 +.RS 4n +List probes instead of enabling them. If the \fB-l\fR option is specified, +\fBdtrace\fR produces a report of the probes matching the descriptions given +using the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, \fB-i\fR, and \fB-s\fR +options. If none of these options are specified, this option lists all probes. +.RE + +.sp +.ne 2 +.na +\fB\fB-m\fR [[\fIprovider:\fR] \fImodule:\fR [[\fIpredicate\fR] +\fIaction\fR]]\fR +.ad +.sp .6 +.RS 4n +Specify module name to trace or list (\fB-l\fR option). The corresponding +argument can include any of the probe description forms \fIprovider:module\fR +or \fImodule\fR. Unspecified probe description fields are left blank and match +any probes regardless of the values in those fields. If no qualifiers other +than \fImodule\fR are specified in the description, all probes with a +corresponding \fImodule\fR are matched. The \fB-m\fR argument can be suffixed +with an optional D probe clause. More than one \fB-m\fR option can be specified +on the command line at a time. +.RE + +.sp +.ne 2 +.na +\fB\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR +[[\fIpredicate\fR] \fIaction\fR]\fR +.ad +.sp .6 +.RS 4n +Specify probe name to trace or list (\fB-l\fR option). The corresponding +argument can include any of the probe description forms +\fIprovider:module:function:name\fR, \fImodule:function:name\fR, +\fIfunction:name\fR, or \fIname\fR. Unspecified probe description fields are +left blank and match any probes regardless of the values in those fields. If no +qualifiers other than \fIname\fR are specified in the description, all probes +with a corresponding \fIname\fR are matched. The \fB-n\fR argument can be +suffixed with an optional D probe clause. More than one \fB-n\fR option can be +specified on the command line at a time. +.RE + +.sp +.ne 2 +.na +\fB\fB-o\fR \fIoutput\fR\fR +.ad +.sp .6 +.RS 4n +Specify the \fIoutput\fR file for the \fB-A\fR , \fB-G\fR, \fB-h\fR, and +\fB-l\fR options, or for the traced data itself. If the \fB-A\fR option is +present and \fB-o\fR is not present, the default output file is +\fB/kernel/drv/dtrace.conf\fR. If the \fB-G\fR option is present and the +\fB-s\fR option's argument is of the form \fB\fIfilename\fR.d\fR and \fB-o\fR +is not present, the default output file is \fB\fIfilename\fR.o\fR. Otherwise +the default output file is \fBd.out\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-p\fR \fIpid\fR\fR +.ad +.sp .6 +.RS 4n +Grab the specified process-ID \fIpid\fR, cache its symbol tables, and exit upon +its completion. If more than one \fB-p\fR option is present on the command +line, \fBdtrace\fR exits when all commands have exited, reporting the exit +status for each process as it terminates. The first process-ID is made +available to any D programs specified on the command line or using the \fB-s\fR +option through the \fB$target\fR macro variable. Refer to the \fISolaris +Dynamic Tracing Guide\fR for more information on macro variables. +.RE + +.sp +.ne 2 +.na +\fB\fB-P\fR \fIprovider\fR \fB[[\fR\fIpredicate\fR\fB]\fR \fIaction\fR]\fR +.ad +.sp .6 +.RS 4n +Specify provider name to trace or list (\fB-l\fR option). The remaining probe +description fields module, function, and name are left blank and match any +probes regardless of the values in those fields. The \fB-P\fR argument can be +suffixed with an optional D probe clause. You can specify more than one +\fB-P\fR option on the command line at a time. +.RE + +.sp +.ne 2 +.na +\fB\fB-q\fR\fR +.ad +.sp .6 +.RS 4n +Set quiet mode. \fBdtrace\fR suppresses messages such as the number of probes +matched by the specified options and D programs and does not print column +headers, the CPU ID, the probe ID, or insert newlines into the output. Only +data traced and formatted by D program statements such as \fBtrace()\fR and +\fBprintf()\fR is displayed to \fBstdout\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-s\fR\fR +.ad +.sp .6 +.RS 4n +Compile the specified D program source file. If the \fB-e\fR option is present, +the program is compiled but instrumentation is not enabled. If the \fB-l\fR +option is present, the program is compiled and the set of probes matched by it +is listed, but instrumentation is not enabled. If none of \fB-e\fR, \fB-l\fR, +\fB-G\fR, or \fB-A\fR are present, the instrumentation specified by the D +program is enabled and tracing begins. +.RE + +.sp +.ne 2 +.na +\fB\fB-S\fR\fR +.ad +.sp .6 +.RS 4n +Show D compiler intermediate code. The D compiler produces a report of the +intermediate code generated for each D program to \fBstderr\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-U\fR \fIname\fR\fR +.ad +.sp .6 +.RS 4n +Undefine the specified \fIname\fR when invoking \fBcpp\fR(1) (enabled using the +\fB-C\fR option). This option passes the \fB-U\fR option to each \fBcpp\fR +invocation. +.RE + +.sp +.ne 2 +.na +\fB\fB-v\fR\fR +.ad +.sp .6 +.RS 4n +Set verbose mode. If the \fB-v\fR option is specified, \fBdtrace\fR produces a +program stability report showing the minimum interface stability and dependency +level for the specified D programs. DTrace stability levels are explained in +further detail in the \fISolaris Dynamic Tracing Guide\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-V\fR\fR +.ad +.sp .6 +.RS 4n +Report the highest D programming interface version supported by \fBdtrace\fR. +The version information is printed to \fBstdout\fR and the \fBdtrace\fR command +exits. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information +about DTrace versioning features. +.RE + +.sp +.ne 2 +.na +\fB\fB-w\fR\fR +.ad +.sp .6 +.RS 4n +Permit destructive actions in D programs specified using the \fB-s\fR, +\fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options. If the \fB-w\fR +option is not specified, \fBdtrace\fR does not permit the compilation or +enabling of a D program that contains destructive actions. +.RE + +.sp +.ne 2 +.na +\fB\fB-x\fR \fIarg\fR [\fI=val\fR]\fR +.ad +.sp .6 +.RS 4n +Enable or modify a DTrace runtime option or D compiler option. The list of +options is found in the \fISolaris Dynamic Tracing Guide\fR. Boolean options +are enabled by specifying their name. Options with values are set by separating +the option name and value with an equals sign (\fB=\fR). +.RE + +.sp +.ne 2 +.na +\fB\fB-X\fR \fBa | c | s | t\fR\fR +.ad +.sp .6 +.RS 4n +Specify the degree of conformance to the ISO C standard that should be selected +when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). The \fB-X\fR +option argument affects the value and presence of the \fB__STDC__\fR macro +depending upon the value of the argument letter. +.sp +The \fB-X\fR option supports the following arguments: +.sp +.ne 2 +.na +\fB\fBa\fR\fR +.ad +.RS 5n +Default. ISO C plus K&R compatibility extensions, with semantic changes +required by ISO C. This is the default mode if \fB-X\fR is not specified. The +predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in +conjunction with the \fB-Xa\fR option. +.RE + +.sp +.ne 2 +.na +\fB\fBc\fR\fR +.ad +.RS 5n +Conformance. Strictly conformant ISO C, without K&R C compatibility extensions. +The predefined macro \fB__STDC__\fR has a value of 1 when \fBcpp\fR is invoked +in conjunction with the \fB-Xc\fR option. +.RE + +.sp +.ne 2 +.na +\fB\fBs\fR\fR +.ad +.RS 5n +K&R C only. The macro \fB__STDC__\fR is not defined when \fBcpp\fR is invoked +in conjunction with the \fB-Xs\fR option. +.RE + +.sp +.ne 2 +.na +\fB\fBt\fR\fR +.ad +.RS 5n +Transition. ISO C plus K&R C compatibility extensions, without semantic changes +required by ISO C. The predefined macro \fB__STDC__\fR has a value of 0 when +\fBcpp\fR is invoked in conjunction with the \fB-Xt\fR option. +.RE + +As the \fB-X\fR option only affects how the D compiler invokes the C +preprocessor, the \fB-Xa\fR and \fB-Xt\fR options are equivalent from the +perspective of D and both are provided only to ease re-use of settings from a C +build environment. +.sp +Regardless of the \fB-X\fR mode, the following additional C preprocessor +definitions are always specified and valid in all modes: +.RS +4 +.TP +.ie t \(bu +.el o +\fB__sun\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__unix\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__SVR4\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__sparc\fR (on SPARC systems only) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__sparcv9\fR (on SPARC systems only when 64-bit programs are compiled) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__i386\fR (on x86 systems only when 32-bit programs are compiled) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__amd64\fR (on x86 systems only when 64-bit programs are compiled) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__\fI`uname -s`\fR_\fI`uname -r`\fR\fR (for example, \fB__SunOS_5_10\fR) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__SUNW_D=1\fR +.RE +.RS +4 +.TP +.ie t \(bu +.el o +\fB__SUNW_D_VERSION=0x\fIMMmmmuuu\fR\fR +.sp +Where \fIMM\fR is the major release value in hexadecimal, \fImmm\fR is the +minor release value in hexadecimal, and \fIuuu\fR is the micro release value in +hexadecimal. Refer to the \fISolaris Dynamic Tracing Guide\fR for more +information about DTrace versioning. +.RE +.RE + +.sp +.ne 2 +.na +\fB\fB-Z\fR\fR +.ad +.sp .6 +.RS 4n +Permit probe descriptions that match zero probes. If the \fB-Z\fR option is not +specified, \fBdtrace\fR reports an error and exits if any probe descriptions +specified in D program files (\fB-s\fR option) or on the command line +(\fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options) contain +descriptions that do not match any known probes. +.RE + +.SH OPERANDS +.sp +.LP +You can specify zero or more additional arguments on the \fBdtrace\fR command +line to define a set of macro variables (\fB$1\fR, \fB$2\fR, and so forth). The +additional arguments can be used in D programs specified using the \fB-s\fR +option or on the command line. The use of macro variables is described further +in the \fISolaris Dynamic Tracing Guide\fR. +.SH EXIT STATUS +.sp +.LP +The following exit values are returned: +.sp +.ne 2 +.na +\fB0\fR +.ad +.RS 5n +Successful completion. +.sp +For D program requests, an exit status of \fB0\fR indicates that programs were +successfully compiled, probes were successfully enabled, or anonymous state was +successfully retrieved. \fBdtrace\fR returns \fB0\fR even if the specified +tracing requests encountered errors or drops. +.RE + +.sp +.ne 2 +.na +\fB\fB1\fR\fR +.ad +.RS 5n +An error occurred. +.sp +For D program requests, an exit status of \fB1\fR indicates that program +compilation failed or that the specified request could not be satisfied. +.RE + +.sp +.ne 2 +.na +\fB\fB2\fR\fR +.ad +.RS 5n +Invalid command line options or arguments were specified. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +Interface Stability See below. +.TE + +.sp +.LP +The command-line syntax is Committed. The human-readable output is Uncommitted. +.SH SEE ALSO +.sp +.LP +\fBcpp\fR(1), \fBisainfo\fR(1), \fBssh\fR(1), \fBlibdtrace\fR(3LIB), +\fBdriver.conf\fR(4), \fBattributes\fR(5), \fBdtrace\fR(7D) +.sp +.LP +\fISolaris Dynamic Tracing Guide\fR +.SH USAGE +.sp +.LP +When using the \fB-p\fR flag, \fBdtrace\fR stops the target processes while it +is inspecting them and reporting results. A process can do nothing while it is +stopped. This means that, if , for example, the X server is inspected by +\fBdtrace\fR running in a window under the X server's control, the whole window +system can become deadlocked, because the \fBproc\fR tool would be attempting +to display its results to a window that cannot be refreshed. In such a case, +logging in from another system using \fBssh\fR(1) and killing the offending +\fBproc\fR tool clears the deadlock. diff --git a/man/man1m/lockstat.1m b/man/man1m/lockstat.1m new file mode 100644 index 0000000000000..8c7eb1749416d --- /dev/null +++ b/man/man1m/lockstat.1m @@ -0,0 +1,873 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" 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. +.\" 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. +.\" 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] +.TH LOCKSTAT 1M "Feb 28, 2008" +.SH NAME +lockstat \- report kernel lock and profiling statistics +.SH SYNOPSIS +.LP +.nf +\fBlockstat\fR [\fB-ACEHI\fR] [\fB-e\fR \fIevent_list\fR] [\fB-i\fR \fIrate\fR] + [\fB-b\fR | \fB-t\fR | \fB-h\fR | \fB-s\fR \fIdepth\fR] [\fB-n\fR \fInrecords\fR] + [\fB-l\fR \fIlock\fR [, \fIsize\fR]] [\fB-d\fR \fIduration\fR] + [\fB-f\fR \fIfunction\fR [, \fIsize\fR]] [\fB-T\fR] [\fB-ckgwWRpP\fR] [\fB-D\fR \fIcount\fR] + [\fB-o\fR \fIfilename\fR] [\fB-x\fR \fIopt\fR [=val]] \fIcommand\fR [\fIargs\fR] +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBlockstat\fR utility gathers and displays kernel locking and profiling +statistics. \fBlockstat\fR allows you to specify which events to watch (for +example, spin on adaptive mutex, block on read access to rwlock due to waiting +writers, and so forth) how much data to gather for each event, and how to +display the data. By default, \fBlockstat\fR monitors all lock contention +events, gathers frequency and timing data about those events, and displays the +data in decreasing frequency order, so that the most common events appear +first. +.sp +.LP +\fBlockstat\fR gathers data until the specified command completes. For example, +to gather statistics for a fixed-time interval, use \fBsleep\fR(1) as the +command, as follows: +.sp +.LP +\fBexample#\fR \fBlockstat\fR \fBsleep\fR \fB5\fR +.sp +.LP +When the \fB-I\fR option is specified, \fBlockstat\fR establishes a +per-processor high-level periodic interrupt source to gather profiling data. +The interrupt handler simply generates a \fBlockstat\fR event whose caller is +the interrupted PC (program counter). The profiling event is just like any +other \fBlockstat\fR event, so all of the normal \fBlockstat\fR options are +applicable. +.sp +.LP +\fBlockstat\fR relies on DTrace to modify the running kernel's text to +intercept events of interest. This imposes a small but measurable overhead on +all system activity, so access to \fBlockstat\fR is restricted to super-user by +default. The system administrator can permit other users to use \fBlockstat\fR +by granting them additional DTrace privileges. Refer to the \fISolaris Dynamic +Tracing Guide\fR for more information about DTrace security features. +.SH OPTIONS +.sp +.LP +The following options are supported: +.SS "Event Selection" +.sp +.LP +If no event selection options are specified, the default is \fB-C\fR. +.sp +.ne 2 +.na +\fB\fB-A\fR\fR +.ad +.sp .6 +.RS 4n +Watch all lock events. \fB-A\fR is equivalent to \fB-CH\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-C\fR\fR +.ad +.sp .6 +.RS 4n +Watch contention events. +.RE + +.sp +.ne 2 +.na +\fB\fB-E\fR\fR +.ad +.sp .6 +.RS 4n +Watch error events. +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-e\fR \fIevent_list\fR\fR +.ad +.sp .6 +.RS 4n +Only watch the specified events. \fIevent\fR \fIlist\fR is a comma-separated +list of events or ranges of events such as 1,4-7,35. Run \fBlockstat\fR with no +arguments to get a brief description of all events. +.RE + +.sp +.ne 2 +.na +\fB\fB-H\fR\fR +.ad +.sp .6 +.RS 4n +Watch hold events. +.RE + +.sp +.ne 2 +.na +\fB\fB-I\fR\fR +.ad +.sp .6 +.RS 4n +Watch profiling interrupt events. +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-i\fR \fIrate\fR\fR +.ad +.sp .6 +.RS 4n +Interrupt rate (per second) for \fB-I\fR. The default is 97 Hz, so that +profiling doesn't run in lockstep with the clock interrupt (which runs at 100 +Hz). +.RE + +.SS "Data Gathering" +.sp +.ne 2 +.na +\fB\fB-x\fR \fIarg\fR[=\fIval\fR]\fR +.ad +.sp .6 +.RS 4n +Enable or modify a DTrace runtime option or D compiler option. The list of +options is found in the \fI\fR. Boolean options are enabled by specifying their +name. Options with values are set by separating the option name and value with +an equals sign (=). +.RE + +.SS "Data Gathering (Mutually Exclusive)" +.sp +.ne 2 +.na +\fB\fB-b\fR\fR +.ad +.sp .6 +.RS 4n +Basic statistics: lock, caller, number of events. +.RE + +.sp +.ne 2 +.na +\fB\fB-h\fR\fR +.ad +.sp .6 +.RS 4n +Histogram: Timing plus time-distribution histograms. +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-s\fR \fIdepth\fR\fR +.ad +.sp .6 +.RS 4n +Stack trace: Histogram plus stack traces up to \fIdepth\fR frames deep. +.RE + +.sp +.ne 2 +.na +\fB\fB-t\fR\fR +.ad +.sp .6 +.RS 4n +Timing: Basic plus timing for all events [default]. +.RE + +.SS "Data Filtering" +.sp +.ne 2 +.na +\fB\fB\fR\fB-d\fR \fIduration\fR\fR +.ad +.sp .6 +.RS 4n +Only watch events longer than \fIduration\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-f\fR \fIfunc[,size]\fR\fR +.ad +.sp .6 +.RS 4n +Only watch events generated by \fIfunc\fR, which can be specified as a symbolic +name or hex address. \fIsize\fR defaults to the \fBELF\fR symbol size if +available, or \fB1\fR if not. +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-l\fR \fIlock[,size]\fR\fR +.ad +.sp .6 +.RS 4n +Only watch \fIlock\fR, which can be specified as a symbolic name or hex +address. \fBsize\fR defaults to the \fBELF\fR symbol size or \fB1\fR if the +symbol size is not available. +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-n\fR \fInrecords\fR\fR +.ad +.sp .6 +.RS 4n +Maximum number of data records. +.RE + +.sp +.ne 2 +.na +\fB\fB-T\fR\fR +.ad +.sp .6 +.RS 4n +Trace (rather than sample) events [off by default]. +.RE + +.SS "Data Reporting" +.sp +.ne 2 +.na +\fB\fB-c\fR\fR +.ad +.sp .6 +.RS 4n +Coalesce lock data for lock arrays (for example, \fBpse_mutex[]\fR). +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-D\fR \fIcount\fR\fR +.ad +.sp .6 +.RS 4n +Only display the top \fIcount\fR events of each type. +.RE + +.sp +.ne 2 +.na +\fB\fB-g\fR\fR +.ad +.sp .6 +.RS 4n +Show total events generated by function. For example, if \fBfoo()\fR calls +\fBbar()\fR in a loop, the work done by \fBbar()\fR counts as work generated by +\fBfoo()\fR (along with any work done by \fBfoo()\fR itself). The \fB-g\fR +option works by counting the total number of stack frames in which each +function appears. This implies two things: (1) the data reported by \fB-g\fR +can be misleading if the stack traces are not deep enough, and (2) functions +that are called recursively might show greater than 100% activity. In light of +issue (1), the default data gathering mode when using \fB-g\fR is \fB-s\fR +\fB50\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-k\fR\fR +.ad +.sp .6 +.RS 4n +Coalesce PCs within functions. +.RE + +.sp +.ne 2 +.na +\fB\fB\fR\fB-o\fR \fIfilename\fR\fR +.ad +.sp .6 +.RS 4n +Direct output to \fIfilename\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-P\fR\fR +.ad +.sp .6 +.RS 4n +Sort data by (\fIcount * time\fR) product. +.RE + +.sp +.ne 2 +.na +\fB\fB-p\fR\fR +.ad +.sp .6 +.RS 4n +Parsable output format. +.RE + +.sp +.ne 2 +.na +\fB\fB-R\fR\fR +.ad +.sp .6 +.RS 4n +Display rates (events per second) rather than counts. +.RE + +.sp +.ne 2 +.na +\fB\fB-W\fR\fR +.ad +.sp .6 +.RS 4n +Whichever: distinguish events only by caller, not by lock. +.RE + +.sp +.ne 2 +.na +\fB\fB-w\fR\fR +.ad +.sp .6 +.RS 4n +Wherever: distinguish events only by lock, not by caller. +.RE + +.SH DISPLAY FORMATS +.sp +.LP +The following headers appear over various columns of data. +.sp +.ne 2 +.na +\fB\fBCount\fR or \fBops/s\fR\fR +.ad +.sp .6 +.RS 4n +Number of times this event occurred, or the rate (times per second) if \fB-R\fR +was specified. +.RE + +.sp +.ne 2 +.na +\fB\fBindv\fR\fR +.ad +.sp .6 +.RS 4n +Percentage of all events represented by this individual event. +.RE + +.sp +.ne 2 +.na +\fB\fBgenr\fR\fR +.ad +.sp .6 +.RS 4n +Percentage of all events generated by this function. +.RE + +.sp +.ne 2 +.na +\fB\fBcuml\fR\fR +.ad +.sp .6 +.RS 4n +Cumulative percentage; a running total of the individuals. +.RE + +.sp +.ne 2 +.na +\fB\fBrcnt\fR\fR +.ad +.sp .6 +.RS 4n +Average reference count. This will always be \fB1\fR for exclusive locks +(mutexes, spin locks, rwlocks held as writer) but can be greater than \fB1\fR +for shared locks (rwlocks held as reader). +.RE + +.sp +.ne 2 +.na +\fB\fBnsec\fR\fR +.ad +.sp .6 +.RS 4n +Average duration of the events in nanoseconds, as appropriate for the event. +For the profiling event, duration means interrupt latency. +.RE + +.sp +.ne 2 +.na +\fB\fBLock\fR\fR +.ad +.sp .6 +.RS 4n +Address of the lock; displayed symbolically if possible. +.RE + +.sp +.ne 2 +.na +\fB\fBCPU+PIL\fR\fR +.ad +.sp .6 +.RS 4n +\fBCPU\fR plus processor interrupt level (\fBPIL\fR). For example, if \fBCPU\fR +4 is interrupted while at \fBPIL\fR 6, this will be reported as \fBcpu[4]+6\fR. +.RE + +.sp +.ne 2 +.na +\fB\fBCaller\fR\fR +.ad +.sp .6 +.RS 4n +Address of the caller; displayed symbolically if possible. +.RE + +.SH EXAMPLES +.LP +\fBExample 1 \fRMeasuring Kernel Lock Contention +.sp +.in +2 +.nf +example# \fBlockstat sleep 5\fR +Adaptive mutex spin: 2210 events in 5.055 seconds (437 events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------ + 269 12% 12% 1.00 2160 service_queue background+0xdc + 249 11% 23% 1.00 86 service_queue qenable_locked+0x64 + 228 10% 34% 1.00 131 service_queue background+0x15c + 68 3% 37% 1.00 79 0x30000024070 untimeout+0x1c + 59 3% 40% 1.00 384 0x300066fa8e0 background+0xb0 + 43 2% 41% 1.00 30 rqcred_lock svc_getreq+0x3c + 42 2% 43% 1.00 341 0x30006834eb8 background+0xb0 + 41 2% 45% 1.00 135 0x30000021058 untimeout+0x1c + 40 2% 47% 1.00 39 rqcred_lock svc_getreq+0x260 + 37 2% 49% 1.00 2372 0x300068e83d0 hmestart+0x1c4 + 36 2% 50% 1.00 77 0x30000021058 timeout_common+0x4 + 36 2% 52% 1.00 354 0x300066fa120 background+0xb0 + 32 1% 53% 1.00 97 0x30000024070 timeout_common+0x4 + 31 1% 55% 1.00 2923 0x300069883d0 hmestart+0x1c4 + 29 1% 56% 1.00 366 0x300066fb290 background+0xb0 + 28 1% 57% 1.00 117 0x3000001e040 untimeout+0x1c + 25 1% 59% 1.00 93 0x3000001e040 timeout_common+0x4 + 22 1% 60% 1.00 25 0x30005161110 sync_stream_buf+0xdc + 21 1% 60% 1.00 291 0x30006834eb8 putq+0xa4 + 19 1% 61% 1.00 43 0x3000515dcb0 mdf_alloc+0xc + 18 1% 62% 1.00 456 0x30006834eb8 qenable+0x8 + 18 1% 63% 1.00 61 service_queue queuerun+0x168 + 17 1% 64% 1.00 268 0x30005418ee8 vmem_free+0x3c +[...] + +R/W reader blocked by writer: 76 events in 5.055 seconds (15 events/sec) + +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------ + 23 30% 30% 1.00 22590137 0x300098ba358 ufs_dirlook+0xd0 + 17 22% 53% 1.00 5820995 0x3000ad815e8 find_bp+0x10 + 13 17% 70% 1.00 2639918 0x300098ba360 ufs_iget+0x198 + 4 5% 75% 1.00 3193015 0x300098ba360 ufs_getattr+0x54 + 3 4% 79% 1.00 7953418 0x3000ad817c0 find_bp+0x10 + 3 4% 83% 1.00 935211 0x3000ad815e8 find_read_lof+0x14 + 2 3% 86% 1.00 16357310 0x300073a4720 find_bp+0x10 + 2 3% 88% 1.00 2072433 0x300073a4720 find_read_lof+0x14 + 2 3% 91% 1.00 1606153 0x300073a4370 find_bp+0x10 + 1 1% 92% 1.00 2656909 0x300107e7400 ufs_iget+0x198 +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 2 \fRMeasuring Hold Times +.sp +.in +2 +.nf +example# \fBlockstat -H -D 10 sleep 1\fR +Adaptive mutex spin: 513 events +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------- + 480 5% 5% 1.00 1136 0x300007718e8 putnext+0x40 + 286 3% 9% 1.00 666 0x3000077b430 getf+0xd8 + 271 3% 12% 1.00 537 0x3000077b430 msgio32+0x2fc + 270 3% 15% 1.00 3670 0x300007718e8 strgetmsg+0x3d4 + 270 3% 18% 1.00 1016 0x300007c38b0 getq_noenab+0x200 + 264 3% 20% 1.00 1649 0x300007718e8 strgetmsg+0xa70 + 216 2% 23% 1.00 6251 tcp_mi_lock tcp_snmp_get+0xfc + 206 2% 25% 1.00 602 thread_free_lock clock+0x250 + 138 2% 27% 1.00 485 0x300007c3998 putnext+0xb8 + 138 2% 28% 1.00 3706 0x300007718e8 strrput+0x5b8 +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 3 \fRMeasuring Hold Times for Stack Traces Containing a Specific +Function +.sp +.in +2 +.nf +example# \fBlockstat -H -f tcp_rput_data -s 50 -D 10 sleep 1\fR +Adaptive mutex spin: 11 events in 1.023 seconds (11 +events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +------------------------------------------------------------------------- +Count indv cuml rcnt nsec Lock Caller + 9 82% 82% 1.00 2540 0x30000031380 tcp_rput_data+0x2b90 + + nsec ------ Time Distribution ------ count Stack + 256 |@@@@@@@@@@@@@@@@ 5 tcp_rput_data+0x2b90 + 512 |@@@@@@ 2 putnext+0x78 + 1024 |@@@ 1 ip_rput+0xec4 + 2048 | 0 _c_putnext+0x148 + 4096 | 0 hmeread+0x31c + 8192 | 0 hmeintr+0x36c + 16384 |@@@ 1 +sbus_intr_wrapper+0x30 +[...] + +Count indv cuml rcnt nsec Lock Caller + 1 9% 91% 1.00 1036 0x30000055380 freemsg+0x44 + + nsec ------ Time Distribution ------ count Stack + 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 freemsg+0x44 + tcp_rput_data+0x2fd0 + putnext+0x78 + ip_rput+0xec4 + _c_putnext+0x148 + hmeread+0x31c + hmeintr+0x36c + +sbus_intr_wrapper+0x30 +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 4 \fRBasic Kernel Profiling +.sp +.LP +For basic profiling, we don't care whether the profiling interrupt sampled +\fBfoo()\fR\fB+0x4c\fR or \fBfoo()\fR\fB+0x78\fR; we care only that it sampled +somewhere in \fBfoo()\fR, so we use \fB-k\fR. The \fBCPU\fR and \fBPIL\fR +aren't relevant to basic profiling because we are measuring the system as a +whole, not a particular \fBCPU\fR or interrupt level, so we use \fB-W\fR. + +.sp +.in +2 +.nf +example# \fBlockstat -kIW -D 20 ./polltest\fR +Profiling interrupt: 82 events in 0.424 seconds (194 +events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Hottest CPU+PIL Caller +----------------------------------------------------------------------- + 8 10% 10% 1.00 698 cpu[1] utl0 + 6 7% 17% 1.00 299 cpu[0] read + 5 6% 23% 1.00 124 cpu[1] getf + 4 5% 28% 1.00 327 cpu[0] fifo_read + 4 5% 33% 1.00 112 cpu[1] poll + 4 5% 38% 1.00 212 cpu[1] uiomove + 4 5% 43% 1.00 361 cpu[1] mutex_tryenter + 3 4% 46% 1.00 682 cpu[0] write + 3 4% 50% 1.00 89 cpu[0] pcache_poll + 3 4% 54% 1.00 118 cpu[1] set_active_fd + 3 4% 57% 1.00 105 cpu[0] syscall_trap32 + 3 4% 61% 1.00 640 cpu[1] (usermode) + 2 2% 63% 1.00 127 cpu[1] fifo_poll + 2 2% 66% 1.00 300 cpu[1] fifo_write + 2 2% 68% 1.00 669 cpu[0] releasef + 2 2% 71% 1.00 112 cpu[1] bt_getlowbit + 2 2% 73% 1.00 247 cpu[1] splx + 2 2% 76% 1.00 503 cpu[0] mutex_enter + 2 2% 78% 1.00 467 cpu[0]+10 disp_lock_enter + 2 2% 80% 1.00 139 cpu[1] default_copyin +----------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 5 \fRGenerated-load Profiling +.sp +.LP +In the example above, 5% of the samples were in \fBpoll()\fR. This tells us how +much time was spent inside \fBpoll()\fR itself, but tells us nothing about how +much work was \fBgenerated\fR by \fBpoll()\fR; that is, how much time we spent +in functions called by \fBpoll()\fR. To determine that, we use the \fB-g\fR +option. The example below shows that although \fBpolltest\fR spends only 5% of +its time in \fBpoll()\fR itself, \fBpoll()\fR-induced work accounts for 34% of +the load. + +.sp +.LP +Note that the functions that generate the profiling interrupt +(\fBlockstat_intr()\fR, \fBcyclic_fire()\fR, and so forth) appear in every +stack trace, and therefore are considered to have generated 100% of the load. +This illustrates an important point: the generated load percentages do +\fBnot\fR add up to 100% because they are not independent. If 72% of all stack +traces contain both \fBfoo()\fR and \fBbar()\fR, then both \fBfoo()\fR and +\fBbar()\fR are 72% load generators. + +.sp +.in +2 +.nf +example# \fBlockstat -kgIW -D 20 ./polltest\fR +Profiling interrupt: 80 events in 0.412 seconds (194 events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count genr cuml rcnt nsec Hottest CPU+PIL Caller +------------------------------------------------------------------------- + 80 100% ---- 1.00 310 cpu[1] lockstat_intr + 80 100% ---- 1.00 310 cpu[1] cyclic_fire + 80 100% ---- 1.00 310 cpu[1] cbe_level14 + 80 100% ---- 1.00 310 cpu[1] current_thread + 27 34% ---- 1.00 176 cpu[1] poll + 20 25% ---- 1.00 221 cpu[0] write + 19 24% ---- 1.00 249 cpu[1] read + 17 21% ---- 1.00 232 cpu[0] write32 + 17 21% ---- 1.00 207 cpu[1] pcache_poll + 14 18% ---- 1.00 319 cpu[0] fifo_write + 13 16% ---- 1.00 214 cpu[1] read32 + 10 12% ---- 1.00 208 cpu[1] fifo_read + 10 12% ---- 1.00 787 cpu[1] utl0 + 9 11% ---- 1.00 178 cpu[0] pcacheset_resolve + 9 11% ---- 1.00 262 cpu[0] uiomove + 7 9% ---- 1.00 506 cpu[1] (usermode) + 5 6% ---- 1.00 195 cpu[1] fifo_poll + 5 6% ---- 1.00 136 cpu[1] syscall_trap32 + 4 5% ---- 1.00 139 cpu[0] releasef + 3 4% ---- 1.00 277 cpu[1] polllock +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 6 \fRGathering Lock Contention and Profiling Data for a Specific +Module +.sp +.LP +In this example we use the \fB-f\fR option not to specify a single function, +but rather to specify the entire text space of the \fBsbus\fR module. We gather +both lock contention and profiling statistics so that contention can be +correlated with overall load on the module. + +.sp +.in +2 +.nf +example# \fBmodinfo | grep sbus\fR + 24 102a8b6f b8b4 59 1 sbus (SBus (sysio) nexus driver) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +example# \fBlockstat -kICE -f 0x102a8b6f,0xb8b4 sleep 10\fR +Adaptive mutex spin: 39 events in 10.042 seconds (4 events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------- + 15 38% 38% 1.00 206 0x30005160528 sync_stream_buf + 7 18% 56% 1.00 14 0x30005160d18 sync_stream_buf + 6 15% 72% 1.00 27 0x300060c3118 sync_stream_buf + 5 13% 85% 1.00 24 0x300060c3510 sync_stream_buf + 2 5% 90% 1.00 29 0x300060c2d20 sync_stream_buf + 2 5% 95% 1.00 24 0x30005161cf8 sync_stream_buf + 1 3% 97% 1.00 21 0x30005161110 sync_stream_buf + 1 3% 100% 1.00 23 0x30005160130 sync_stream_buf +[...] + +Adaptive mutex block: 9 events in 10.042 seconds (1 events/sec) + +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------- + 4 44% 44% 1.00 156539 0x30005160528 sync_stream_buf + 2 22% 67% 1.00 763516 0x30005160d18 sync_stream_buf + 1 11% 78% 1.00 462130 0x300060c3510 sync_stream_buf + 1 11% 89% 1.00 288749 0x30005161110 sync_stream_buf + 1 11% 100% 1.00 1015374 0x30005160130 sync_stream_buf +[...] + +Profiling interrupt: 229 events in 10.042 seconds (23 events/sec) + +Count indv cuml rcnt nsec Hottest CPU+PIL Caller + +------------------------------------------------------------------------- + 89 39% 39% 1.00 426 cpu[0]+6 sync_stream_buf + 64 28% 67% 1.00 398 cpu[0]+6 sbus_intr_wrapper + 23 10% 77% 1.00 324 cpu[0]+6 iommu_dvma_kaddr_load + 21 9% 86% 1.00 512 cpu[0]+6 iommu_tlb_flush + 14 6% 92% 1.00 342 cpu[0]+6 iommu_dvma_unload + 13 6% 98% 1.00 306 cpu[1] iommu_dvma_sync + 5 2% 100% 1.00 389 cpu[1] iommu_dma_bindhdl +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 7 \fRDetermining the Average PIL (processor interrupt level) for a +CPU +.sp +.in +2 +.nf +example# \fBlockstat -Iw -l cpu[3] ./testprog\fR + +Profiling interrupt: 14791 events in 152.463 seconds (97 events/sec) + +Count indv cuml rcnt nsec CPU+PIL Hottest Caller + +----------------------------------------------------------------------- +13641 92% 92% 1.00 253 cpu[3] (usermode) + 579 4% 96% 1.00 325 cpu[3]+6 ip_ocsum+0xe8 + 375 3% 99% 1.00 411 cpu[3]+10 splx + 154 1% 100% 1.00 527 cpu[3]+4 fas_intr_svc+0x80 + 41 0% 100% 1.00 293 cpu[3]+13 send_mondo+0x18 + 1 0% 100% 1.00 266 cpu[3]+12 zsa_rxint+0x400 +----------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 8 \fRDetermining which Subsystem is Causing the System to be Busy +.sp +.in +2 +.nf +example# \fBlockstat -s 10 -I sleep 20\fR + +Profiling interrupt: 4863 events in 47.375 seconds (103 events/sec) + +Count indv cuml rcnt nsec CPU+PIL Caller + +----------------------------------------------------------------------- +1929 40% 40% 0.00 3215 cpu[0] usec_delay+0x78 + nsec ------ Time Distribution ------ count Stack + 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1872 ata_wait+0x90 + 8192 | 27 acersb_get_intr_status+0x34 + 16384 | 29 ata_set_feature+0x124 + 32768 | 1 ata_disk_start+0x15c + ata_hba_start+0xbc + ghd_waitq_process_and \e + _mutex_hold+0x70 + ghd_waitq_process_and \e + _mutex_exit+0x4 + ghd_transport+0x12c + ata_disk_tran_start+0x108 +----------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.SH SEE ALSO +.sp +.LP +\fBdtrace\fR(1M), \fBplockstat\fR(1M), \fBattributes\fR(5), \fBlockstat\fR(7D), +\fBmutex\fR(9F), \fBrwlock\fR(9F) +.sp +.LP +\fISolaris Dynamic Tracing Guide\fR +.SH NOTES +.sp +.LP +The profiling support provided by \fBlockstat\fR \fB-I\fR replaces the old (and +undocumented) \fB/usr/bin/kgmon\fR and \fB/dev/profile\fR. +.sp +.LP +Tail-call elimination can affect call sites. For example, if +\fBfoo()\fR\fB+0x50\fR calls \fBbar()\fR and the last thing \fBbar()\fR does is +call \fBmutex_exit()\fR, the compiler can arrange for \fBbar()\fR to branch to +\fBmutex_exit()\fRwith a return address of \fBfoo()\fR\fB+0x58\fR. Thus, the +\fBmutex_exit()\fR in \fBbar()\fR will appear as though it occurred at +\fBfoo()\fR\fB+0x58\fR. +.sp +.LP +The \fBPC\fR in the stack frame in which an interrupt occurs can be bogus +because, between function calls, the compiler is free to use the return address +register for local storage. +.sp +.LP +When using the \fB-I\fR and \fB-s\fR options together, the interrupted PC will +usually not appear anywhere in the stack since the interrupt handler is entered +asynchronously, not by a function call from that \fBPC\fR. +.sp +.LP +The \fBlockstat\fR technology is provided on an as-is basis. The format and +content of \fBlockstat\fR output reflect the current Solaris kernel +implementation and are therefore subject to change in future releases. diff --git a/man/man1m/plockstat.1m b/man/man1m/plockstat.1m new file mode 100644 index 0000000000000..b24f36d67d0b5 --- /dev/null +++ b/man/man1m/plockstat.1m @@ -0,0 +1,238 @@ +'\" te +.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" 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. +.\" 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. +.\" 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] +.TH PLOCKSTAT 1M "Jan 26, 2009" +.SH NAME +plockstat \- report user-level lock statistics +.SH SYNOPSIS +.LP +.nf +\fBplockstat\fR [\fB-vACHV\fR] [\fB-n\fR \fIcount\fR] [\fB-s\fR \fIdepth\fR] [\fB-e\fR \fIsecs\fR] + [\fB-x\fR \fIarg\fR [=val]] \fIcommand\fR [\fIarg\fR]... +.fi + +.LP +.nf +\fBplockstat\fR [\fB-vACHV\fR] [\fB-n\fR \fIcount\fR] [\fB-s\fR \fIdepth\fR] [\fB-e\fR \fIsecs\fR] + [\fB-x\fR \fIarg\fR [=val]] \fB-p\fR \fIpid\fR +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBplockstat\fR utility gathers and displays user-level locking statistics. +By default, \fBplockstat\fR monitors all lock contention events, gathers +frequency and timing data about those events, and displays the data in +decreasing frequency order, so that the most common events appear first. +.sp +.LP +\fBplockstat\fR gathers data until the specified command completes or the +process specified with the \fB-p\fR option completes. +.sp +.LP +\fBplockstat\fR relies on DTrace to instrument a running process or a command +it invokes to trace events of interest. This imposes a small but measurable +performance overhead on the processes being observed. Users must have the +\fBdtrace_proc\fR privilege and have permission to observe a particular process +with \fBplockstat\fR. Refer to the \fI\fR for more information about DTrace +security features. +.SH OPTIONS +.sp +.LP +The following options are supported: +.sp +.ne 2 +.na +\fB\fB-A\fR\fR +.ad +.RS 16n +Watch all lock events. This option is equivalent to \fB-CH\fR. +.RE + +.sp +.ne 2 +.na +\fB\fB-C\fR\fR +.ad +.RS 16n +Watch contention events. +.RE + +.sp +.ne 2 +.na +\fB\fB-H\fR\fR +.ad +.RS 16n +Watch hold events. +.RE + +.sp +.ne 2 +.na +\fB\fB-e\fR \fIsecs\fR\fR +.ad +.RS 16n +Exit after the number of seconds specified have elapsed. +.RE + +.sp +.ne 2 +.na +\fB\fB-n\fR \fIcount\fR\fR +.ad +.RS 16n +Display only the specified number of entries for each output category. +.RE + +.sp +.ne 2 +.na +\fB\fB-s\fR \fIdepth\fR\fR +.ad +.RS 16n +Record a stack trace rather than just the calling function. +.RE + +.sp +.ne 2 +.na +\fB\fB-p\fR \fIpid\fR\fR +.ad +.RS 16n +Specify a process ID from which \fBplockstat\fR is to gather data. +.RE + +.sp +.ne 2 +.na +\fB\fB-v\fR\fR +.ad +.RS 16n +Print out a message to indicate that tracing has started. +.RE + +.sp +.ne 2 +.na +\fB\fB-x\fR \fIarg\fR[=\fIval\fR]\fR +.ad +.RS 16n +Enable or modify a DTrace runtime option or D compiler option. The list of +options is found in the \fISolaris Dynamic Tracing Guide\fR. Boolean options +are enabled by specifying their name. Options with values are set by separating +the option name and value with an equals sign (\fB=\fR). +.RE + +.sp +.ne 2 +.na +\fB\fB-V\fR\fR +.ad +.RS 16n +Print the Dtrace commands used to gather the data. The output can then be used +directly with the \fBdtrace\fR(1M) command. +.RE + +.SH OPERANDS +.sp +.LP +The following operands are supported: +.sp +.ne 2 +.na +\fB\fIarg\fR\fR +.ad +.RS 11n +A string to be passed as an argument to \fIcommand\fR. +.RE + +.sp +.ne 2 +.na +\fB\fIcommand\fR\fR +.ad +.RS 11n +The name of a utility to be invoked. +.RE + +.sp +.ne 2 +.na +\fB\fIcount\fR\fR +.ad +.RS 11n +A positive integer value. +.RE + +.sp +.ne 2 +.na +\fB\fIpid\fR\fR +.ad +.RS 11n +A process identifier for a process to be monitored. +.RE + +.sp +.ne 2 +.na +\fB\fIsecs\fR\fR +.ad +.RS 11n +Duration specified as a positive integer number of seconds. +.RE + +.SH EXIT STATUS +.sp +.LP +The following exit values are returned: +.sp +.ne 2 +.na +\fB\fB0\fR\fR +.ad +.RS 6n +Successful completion. +.RE + +.sp +.ne 2 +.na +\fB>\fB0\fR\fR +.ad +.RS 6n +An error occurred. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +box; +c | c +l | l . +ATTRIBUTE TYPE ATTRIBUTE VALUE +_ +Interface Stability See below. +.TE + +.sp +.LP +The command-line syntax is Evolving. The human-readable output is Unstable. +.SH SEE ALSO +.sp +.LP +\fBdtrace\fR(1M), \fBlockstat\fR(1M), \fBmutex_init\fR(3C), +\fBpthread_mutex_lock\fR(3C), \fBpthread_rwlock_rdlock\fR(3C), +\fBpthread_rwlock_wrlock\fR(3C), \fBpthread_rwlock_unlock\fR(3C), +\fBrwlock\fR(3C), \fBattributes\fR(5), \fBfasttrap\fR(7D) +.sp +.LP +\fI\fR |