Vendor import of the DTrace app and test suite from OpenSolaris.

This commit is contained in:
jb 2008-04-25 06:56:31 +00:00
commit 871ee96d6f
1428 changed files with 86505 additions and 0 deletions

View File

@ -0,0 +1,670 @@
'\" te
.\" CDDL HEADER START
.\"
.\" 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]
.\"
.\" CDDL HEADER END
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
.TH dtrace 1M "5 Sep 2006" "SunOS 5.11" "System Administration Commands"
.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 intepretation of meta-characters by the shell.
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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, 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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.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
.mk
.na
\fB\fBa\fR\fR
.ad
.RS 5n
.rt
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
.mk
.na
\fB\fBc\fR\fR
.ad
.RS 5n
.rt
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
.mk
.na
\fB\fBs\fR\fR
.ad
.RS 5n
.rt
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
.mk
.na
\fB\fBt\fR\fR
.ad
.RS 5n
.rt
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
.mk
.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
.mk
.na
\fB0\fR
.ad
.RS 5n
.rt
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
.mk
.na
\fB\fB1\fR\fR
.ad
.RS 5n
.rt
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
.mk
.na
\fB\fB2\fR\fR
.ad
.RS 5n
.rt
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
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
AvailabilitySUNWdtrc
_
Interface StabilitySee 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), \fBlibdtrace\fR(3LIB), \fBdriver.conf\fR(4), \fBattributes\fR(5), \fBdtrace\fR(7D)
.sp
.LP
\fISolaris Dynamic Tracing Guide\fR

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
CDDL HEADER START
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]
CDDL HEADER END
Copyright 2006 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
ident "%Z%%M% %I% %E% SMI"
DTrace Testing Suite
The SUNWdtrt package delivers a set of test programs and D source
files into the directory /opt/SUNWdtrt. For more information see
the following web site:
http://www.opensolaris.org/os/community/dtrace/dtest

View File

@ -0,0 +1,209 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/varargs.h>
#include <errno.h>
#include <math.h>
#include <dtrace.h>
void
fatal(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s: ", "baddof");
vfprintf(stderr, fmt, ap);
if (fmt[strlen(fmt) - 1] != '\n')
fprintf(stderr, ": %s\n", strerror(errno));
exit(1);
}
#define LEAP_DISTANCE 20
void
corrupt(int fd, unsigned char *buf, int len)
{
static int ttl, valid;
int bit, i;
unsigned char saved;
int val[LEAP_DISTANCE], pos[LEAP_DISTANCE];
int new, rv;
again:
printf("valid DOF #%d\n", valid++);
/*
* We are going iterate through, flipping one bit and attempting
* to enable.
*/
for (bit = 0; bit < len * 8; bit++) {
saved = buf[bit / 8];
buf[bit / 8] ^= (1 << (bit % 8));
if ((bit % 100) == 0)
printf("%d\n", bit);
if ((rv = ioctl(fd, DTRACEIOC_ENABLE, buf)) == -1) {
/*
* That failed -- restore the bit and drive on.
*/
buf[bit / 8] = saved;
continue;
}
/*
* That worked -- and it may have enabled probes. To keep
* enabled probes down to a reasonable level, we'll close
* and reopen pseudodevice if we have more than 10,000
* probes enabled.
*/
ttl += rv;
if (ttl < 10000) {
buf[bit / 8] = saved;
continue;
}
printf("enabled %d probes; resetting device.\n", ttl);
close(fd);
new = open("/devices/pseudo/dtrace@0:dtrace", O_RDWR);
if (new == -1)
fatal("couldn't open DTrace pseudo device");
if (new != fd) {
dup2(new, fd);
close(new);
}
ttl = 0;
buf[bit / 8] = saved;
}
for (;;) {
/*
* Now we want to get as many bits away as possible. We flip
* bits randomly -- getting as far away as we can until we don't
* seem to be making any progress.
*/
for (i = 0; i < LEAP_DISTANCE; i++) {
/*
* Pick a random bit and corrupt it.
*/
bit = lrand48() % (len * 8);
val[i] = buf[bit / 8];
pos[i] = bit / 8;
buf[bit / 8] ^= (1 << (bit % 8));
}
/*
* Let's see if that managed to get us valid DOF...
*/
if ((rv = ioctl(fd, DTRACEIOC_ENABLE, buf)) > 0) {
/*
* Success! This will be our new base for valid DOF.
*/
ttl += rv;
goto again;
}
/*
* No luck -- we'll restore those bits and try flipping a
* different set. Note that this must be done in reverse
* order...
*/
for (i = LEAP_DISTANCE - 1; i >= 0; i--)
buf[pos[i]] = val[i];
}
}
int
main(int argc, char **argv)
{
char *filename = argv[1];
dtrace_hdl_t *dtp;
dtrace_prog_t *pgp;
int err, fd, len;
FILE *fp;
unsigned char *dof, *copy;
if (argc < 1)
fatal("expected D script as argument\n");
if ((fp = fopen(filename, "r")) == NULL)
fatal("couldn't open %s", filename);
/*
* First, we need to compile our provided D into DOF.
*/
if ((dtp = dtrace_open(DTRACE_VERSION, 0, &err)) == NULL) {
fatal("cannot open dtrace library: %s\n",
dtrace_errmsg(NULL, err));
}
pgp = dtrace_program_fcompile(dtp, fp, 0, 0, NULL);
fclose(fp);
if (pgp == NULL) {
fatal("failed to compile script %s: %s\n", filename,
dtrace_errmsg(dtp, dtrace_errno(dtp)));
}
dof = dtrace_dof_create(dtp, pgp, 0);
len = ((dof_hdr_t *)dof)->dofh_loadsz;
if ((copy = malloc(len)) == NULL)
fatal("could not allocate copy of %d bytes", len);
for (;;) {
bcopy(dof, copy, len);
/*
* Open another instance of the dtrace device.
*/
fd = open("/devices/pseudo/dtrace@0:dtrace", O_RDWR);
if (fd == -1)
fatal("couldn't open DTrace pseudo device");
corrupt(fd, copy, len);
close(fd);
}
/* NOTREACHED */
return (0);
}

View File

@ -0,0 +1,145 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/varargs.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <unistd.h>
#define DTRACEIOC (('d' << 24) | ('t' << 16) | ('r' << 8))
#define DTRACEIOC_MAX 17
void
fatal(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "%s: ", "badioctl");
vfprintf(stderr, fmt, ap);
if (fmt[strlen(fmt) - 1] != '\n')
fprintf(stderr, ": %s\n", strerror(errno));
exit(1);
}
void
badioctl(pid_t parent)
{
int fd = -1, random, ps = sysconf(_SC_PAGESIZE);
int i = 0, seconds;
caddr_t addr;
hrtime_t now, last = 0, end;
if ((random = open("/dev/random", O_RDONLY)) == -1)
fatal("couldn't open /dev/random");
if ((addr = mmap(0, ps, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0)) == (caddr_t)-1)
fatal("mmap");
for (;;) {
unsigned int ioc;
if ((now = gethrtime()) - last > NANOSEC) {
if (kill(parent, 0) == -1 && errno == ESRCH) {
/*
* Our parent died. We will kill ourselves in
* sympathy.
*/
exit(0);
}
/*
* Once a second, we'll reopen the device.
*/
if (fd != -1)
close(fd);
fd = open("/devices/pseudo/dtrace@0:dtrace", O_RDONLY);
if (fd == -1)
fatal("couldn't open DTrace pseudo device");
last = now;
}
if ((i++ % 1000) == 0) {
/*
* Every thousand iterations, change our random gunk.
*/
read(random, addr, ps);
}
read(random, &ioc, sizeof (ioc));
ioc %= DTRACEIOC_MAX;
ioc++;
ioctl(fd, DTRACEIOC | ioc, addr);
}
}
int
main()
{
pid_t child, parent = getpid();
int status;
for (;;) {
if ((child = fork()) == 0)
badioctl(parent);
while (waitpid(child, &status, WEXITED) != child)
continue;
if (WIFEXITED(status)) {
/*
* Our child exited by design -- we'll exit with
* the same status code.
*/
exit(WEXITSTATUS(status));
}
/*
* Our child died on a signal. Respawn it.
*/
printf("badioctl: child died on signal %d; respawning.\n",
WTERMSIG(status));
fflush(stdout);
}
/* NOTREACHED */
return (0);
}

View File

@ -0,0 +1,148 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <strings.h>
#include <unistd.h>
#include <dtrace.h>
static int g_count;
static int g_errs;
static int g_fd;
static int g_verbose;
static int g_errexit;
static int
probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *data)
{
dtrace_probeinfo_t p;
dtrace_argdesc_t arg;
char buf[BUFSIZ];
int i;
(void) printf("\r%6d", ++g_count);
(void) fflush(stdout);
if (dtrace_probe_info(dtp, pdp, &p) != 0) {
(void) printf(" failed to get probe info for "
"%s:%s:%s:%s [%d]\n", pdp->dtpd_provider, pdp->dtpd_mod,
pdp->dtpd_func, pdp->dtpd_name, pdp->dtpd_id);
g_errs++;
return (0);
}
for (i = 0; i < p.dtp_argc; i++) {
if (p.dtp_argv[i].dtt_type == CTF_ERR) {
bzero(&arg, sizeof (dtrace_argdesc_t));
arg.dtargd_id = pdp->dtpd_id;
arg.dtargd_ndx = i;
(void) ioctl(g_fd, DTRACEIOC_PROBEARG, &arg);
(void) printf(" failed to get types for args[%d] "
"of %s:%s:%s:%s [%d]: <%s> -> <%s>\n", i,
pdp->dtpd_provider, pdp->dtpd_mod, pdp->dtpd_func,
pdp->dtpd_name, pdp->dtpd_id,
arg.dtargd_native, arg.dtargd_xlate);
g_errs++;
if (g_errexit)
return (-1);
} else if (g_verbose) {
(void) printf("%d args[%d] : %s\n", pdp->dtpd_id, i,
ctf_type_name(p.dtp_argv[i].dtt_ctfp,
p.dtp_argv[i].dtt_type, buf, sizeof (buf)));
}
}
return (0);
}
int
main(int argc, char *argv[])
{
dtrace_probedesc_t pd, *pdp = NULL;
dtrace_hdl_t *dtp;
int err, c;
char *p;
if ((dtp = dtrace_open(DTRACE_VERSION, 0, &err)) == NULL) {
(void) fprintf(stderr, "%s: failed to open dtrace: %s\n",
argv[0], dtrace_errmsg(dtp, err));
return (1);
}
while ((c = getopt(argc, argv, "evx:")) != -1) {
switch (c) {
case 'e':
g_errexit++;
break;
case 'v':
g_verbose++;
break;
case 'x':
if ((p = strchr(optarg, '=')) != NULL)
*p++ = '\0';
if (dtrace_setopt(dtp, optarg, p) != 0) {
(void) fprintf(stderr, "%s: failed to set "
"option -x %s: %s\n", argv[0], optarg,
dtrace_errmsg(dtp, dtrace_errno(dtp)));
return (2);
}
break;
default:
(void) fprintf(stderr, "Usage: %s [-ev] "
"[-x opt[=arg]] [probedesc]\n", argv[0]);
return (2);
}
}
argv += optind;
argc -= optind;
if (argc > 0) {
if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[1], &pd)) {
(void) fprintf(stderr, "%s: invalid probe description "
"%s: %s\n", argv[0], argv[1],
dtrace_errmsg(dtp, dtrace_errno(dtp)));
return (2);
}
pdp = &pd;
}
g_fd = dtrace_ctlfd(dtp);
(void) dtrace_probe_iter(dtp, pdp, probe, NULL);
dtrace_close(dtp);
(void) printf("\nTotal probes: %d\n", g_count);
(void) printf("Total errors: %d\n\n", g_errs);
return (g_errs != 0);
}

View File

@ -0,0 +1,453 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* ident "%Z%%M% %I% %E% SMI"
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
import java.io.StringWriter;
import java.io.PrintWriter;
/**
* A Java port of Solaris {@code lib/libc/port/gen/getopt.c}, which is a
* port of System V UNIX getopt. See <b>getopt(3C)</b> and SUS/XPG
* getopt() for function definition and requirements. Unlike that
* definition, this implementation moves non-options to the end of the
* argv array rather than quitting at the first non-option.
*/
public class Getopt {
static final int EOF = -1;
private String progname;
private String[] args;
private int argc;
private String optstring;
private int optind = 0; // args index
private int optopt = 0;
private String optarg = null;
private boolean opterr = true;
/*
* _sp is required to keep state between successive calls to
* getopt() while extracting aggregated short-options (ie: -abcd).
*/
private int _sp = 1;
/**
* Creates a {Code Getopt} instance to parse the given command-line
* arguments. Modifies the given args array by swapping the
* positions of non-options and options so that non-options appear
* at the end of the array.
*/
public Getopt(String programName, String[] args,
String optionString)
{
progname = programName;
// No defensive copy; Getopt is expected to modify the given
// args array
this.args = args;
argc = this.args.length;
optstring = optionString;
validate();
}
private void
validate()
{
if (progname == null) {
throw new NullPointerException("program name is null");
}
int i = 0;
for (String s : args) {
if (s == null) {
throw new NullPointerException("null arg at index " + i);
}
++i;
}
if (optstring == null) {
throw new NullPointerException("option string is null");
}
}
private static class StringRef {
private String s;
public String
get()
{
return s;
}
public StringRef
set(String value)
{
s = value;
return this;
}
}
/*
* Generalized error processing method. If the optstr parameter is
* null, the character c is converted to a string and displayed
* instead.
*/
void
err(String format, char c, String optstr)
{
if (opterr && optstring.charAt(0) != ':') {
StringWriter w = new StringWriter();
PrintWriter p = new PrintWriter(w);
p.printf(format, progname, (optstr == null ?
Character.toString(c) : optstr.substring(2)));
System.err.println(w.toString());
}
}
/*
* Determine if the specified character (c) is present in the string
* (optstring) as a regular, single character option. If the option
* is found, return an index into optstring where the short-option
* character is found, otherwise return -1. The characters ':' and
* '(' are not allowed.
*/
static int
parseshort(String optstring, char c)
{
if (c == ':' || c == '(') {
return -1;
}
int ch;
int len = optstring.length();
for (int i = 0; i < len; ++i) {
ch = optstring.charAt(i);
if (ch == c) {
return i;
}
while (i < len && ch == '(') {
for (++i; i < len && (ch = optstring.charAt(i)) != ')'; ++i);
}
}
return -1;
}
/**
* Determine if the specified string (opt) is present in the string
* (optstring) as a long-option contained within parenthesis. If the
* long-option specifies option-argument, return a reference to it
* in longoptarg. Otherwise set the longoptarg reference to null.
* If the option is found, return an index into optstring at the
* position of the short-option character associated with the
* long-option; otherwise return -1.
*
* @param optstring the entire optstring passed to the {@code
* Getopt} constructor
* @param opt the long option read from the command line
* @param longoptarg the value of the option is returned in this
* parameter, if an option exists. Possible return values in
* longoptarg are:
* <ul>
* <li><b>NULL:</b> No argument was found</li>
* <li><b>empty string (""):</b> Argument was explicitly left empty
* by the user (e.g., --option= )</li>
* <li><b>valid string:</b> Argument found on the command line</li>
* </ul>
* @return index to equivalent short-option in optstring, or -1 if
* option not found in optstring.
*/
static int
parselong(String optstring, String opt, StringRef longoptarg)
{
int cp; // index into optstring, beginning of one option spec
int ip; // index into optstring, traverses every char
char ic; // optstring char
int il; // optstring length
int op; // index into opt
char oc; // opt char
int ol; // opt length
boolean match; // true if opt is matching part of optstring
longoptarg.set(null);
cp = ip = 0;
il = optstring.length();
ol = opt.length();
do {
ic = optstring.charAt(ip);
if (ic != '(' && ++ip == il)
break;
ic = optstring.charAt(ip);
if (ic == ':' && ++ip == il)
break;
ic = optstring.charAt(ip);
while (ic == '(') {
if (++ip == il)
break;
op = 0;
match = true;
while (ip < il && (ic = optstring.charAt(ip)) != ')' &&
op < ol) {
oc = opt.charAt(op++);
match = (ic == oc && match);
++ip;
}
if (match && ip < il && ic == ')' && (op >= ol ||
opt.charAt(op) == '=')) {
if (op < ol && opt.charAt(op) == '=') {
/* may be an empty string - OK */
longoptarg.set(opt.substring(op + 1));
} else {
longoptarg.set(null);
}
return cp;
}
if (ip < il && ic == ')' && ++ip == il)
break;
ic = optstring.charAt(ip);
}
cp = ip;
/*
* Handle double-colon in optstring ("a::(longa)") The old
* getopt() accepts it and treats it as a required argument.
*/
while ((cp > 0) && (cp < il) && (optstring.charAt(cp) == ':')) {
--cp;
}
} while (cp < il);
return -1;
}
/**
* Get the current option value.
*/
public String
getOptarg()
{
return optarg;
}
/**
* Get the index of the next option to be parsed.
*/
public int
getOptind()
{
return optind;
}
/**
* Gets the command-line arguments.
*/
public String[]
getArgv()
{
// No defensive copy: Getopt is expected to modify the given
// args array.
return args;
}
/**
* Gets the aggregated short option that just failed. Since long
* options can't be aggregated, a failed long option can be obtained
* by {@code getArgv()[getOptind() - 1]}.
*/
public int
getOptopt()
{
return optopt;
}
/**
* Set to {@code false} to suppress diagnostic messages to stderr.
*/
public void
setOpterr(boolean err)
{
opterr = err;
}
/**
* Gets the next option character, or -1 if there are no more
* options. If getopt() encounters a short-option character or a
* long-option string not described in the {@code optionString}
* argument to the constructor, it returns the question-mark (?)
* character. If it detects a missing option-argument, it also
* returns the question-mark (?) character, unless the first
* character of the {@code optionString} argument was a colon (:),
* in which case getopt() returns the colon (:) character.
* <p>
* This implementation swaps the positions of options and
* non-options in the given argv array.
*/
public int
getopt()
{
char c;
int cp;
boolean longopt;
StringRef longoptarg = new StringRef();
/*
* Has the end of the options been encountered? The following
* implements the SUS requirements:
*
* If, when getopt() is called:
* - the first character of argv[optind] is not '-'
* - argv[optind] is the string "-"
* getopt() returns -1 without changing optind if
* - argv[optind] is the string "--"
* getopt() returns -1 after incrementing optind
*/
if (_sp == 1) {
boolean nonOption;
do {
nonOption = false;
if (optind >= argc || args[optind].equals("-")) {
return EOF;
} else if (args[optind].equals("--")) {
++optind;
return EOF;
} else if (args[optind].charAt(0) != '-') {
// non-option: here we deviate from the SUS requirements
// by not quitting, and instead move non-options to the
// end of the args array
nonOption = true;
String tmp = args[optind];
if (optind + 1 < args.length) {
System.arraycopy(args, optind + 1, args, optind,
args.length - (optind + 1));
args[args.length - 1] = tmp;
}
--argc;
}
} while (nonOption);
}
/*
* Getting this far indicates that an option has been encountered.
* Note that the syntax of optstring applies special meanings to
* the characters ':' and '(', so they are not permissible as
* option letters. A special meaning is also applied to the ')'
* character, but its meaning can be determined from context.
* Note that the specification only requires that the alnum
* characters be accepted.
*
* If the second character of the argument is a '-' this must be
* a long-option, otherwise it must be a short option. Scan for
* the option in optstring by the appropriate algorithm. Either
* scan will return an index to the short-option character in
* optstring if the option is found and -1 otherwise.
*
* For an unrecognized long-option, optopt will equal 0, but
* since long-options can't aggregate the failing option can be
* identified by argv[optind-1].
*/
optopt = c = args[optind].charAt(_sp);
optarg = null;
longopt = (_sp == 1 && c == '-');
if (!(longopt
? ((cp = parselong(optstring, args[optind].substring(2),
longoptarg)) != -1)
: ((cp = parseshort(optstring, c)) != -1))) {
err("%s: illegal option -- %s", c,
(longopt ? args[optind] : null));
/*
* Note: When the long option is unrecognized, optopt will
* be '-' here, which matches the specification.
*/
if (args[optind].length() == ++_sp || longopt) {
++optind;
_sp = 1;
}
return '?';
}
optopt = c = optstring.charAt(cp);
/*
* A valid option has been identified. If it should have an
* option-argument, process that now. SUS defines the setting
* of optarg as follows:
*
* 1. If the option was the last character in an element of
* argv, then optarg contains the next element of argv, and
* optind is incremented by 2. If the resulting value of
* optind is not less than argc, this indicates a missing
* option-argument, and getopt() returns an error indication.
*
* 2. Otherwise, optarg points to the string following the
* option character in that element of argv, and optind is
* incremented by 1.
*
* The second clause allows -abcd (where b requires an
* option-argument) to be interpreted as "-a -b cd".
*
* Note that the option-argument can legally be an empty string,
* such as:
* command --option= operand
* which explicitly sets the value of --option to nil
*/
if (cp + 1 < optstring.length() && optstring.charAt(cp + 1) == ':') {
// The option takes an argument
if (!longopt && ((_sp + 1) < args[optind].length())) {
optarg = args[optind++].substring(_sp + 1);
} else if (longopt && (longoptarg.get() != null)) {
/*
* The option argument was explicitly set to the empty
* string on the command line (--option=)
*/
optind++;
optarg = longoptarg.get();
} else if (++optind >= argc) {
err("%s: option requires an argument -- %s", c,
(longopt ? args[optind - 1] : null));
_sp = 1;
optarg = null;
return (optstring.charAt(0) == ':' ? ':' : '?');
} else
optarg = args[optind++];
_sp = 1;
} else {
// The option does NOT take an argument
if (longopt && (longoptarg.get() != null)) {
// User supplied an arg to an option that takes none
err("%s: option doesn't take an argument -- %s", (char)0,
(longopt ? args[optind] : null));
optarg = longoptarg.set(null).get();
c = '?';
}
if (longopt || args[optind].length() == ++_sp) {
_sp = 1;
++optind;
}
optarg = null;
}
return (c);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
#
# CDDL HEADER START
#
# 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]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
# Exception list: names tests that are bypassed when running in Java
# mode (relative to /opt/SUNWdtrt/tst)
# double precision (64-bit floating point) not same in java
common/aggs/tst.neglquant.d
common/aggs/tst.negquant.d
# freopen() (to suppress output) not supported by Java DTrace API
common/printa/tst.walltimestamp.ksh
# -G option not supported by jdtrace
common/dtraceUtil/tst.ELFGenerationOut.d.ksh
common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
# -H option not supported by jdtrace
common/dtraceUtil/tst.PreprocessorStatement.d.ksh
# -G and -h options not supported by jdtrace
common/usdt/tst.badguess.ksh
common/usdt/tst.dlclose1.ksh
common/usdt/tst.dlclose2.ksh
common/usdt/tst.dlclose3.ksh
common/usdt/tst.eliminate.ksh
common/usdt/tst.enabled.ksh
common/usdt/tst.entryreturn.ksh
common/usdt/tst.fork.ksh
common/usdt/tst.header.ksh
common/usdt/tst.guess32.ksh
common/usdt/tst.guess64.ksh
common/usdt/tst.linkpriv.ksh
common/usdt/tst.linkunpriv.ksh
common/usdt/tst.multiple.ksh
common/usdt/tst.nodtrace.ksh
common/usdt/tst.onlyenabled.ksh
common/usdt/tst.reeval.ksh
common/usdt/tst.static.ksh
common/usdt/tst.static2.ksh
common/usdt/tst.user.ksh
sparc/usdt/tst.tailcall.ksh
common/pid/tst.provregex3.ksh
common/pid/tst.provregex4.ksh
# freopen() and ftruncate() not supported by Java DTrace API
common/funcs/tst.badfreopen.ksh
common/funcs/tst.freopen.ksh
common/funcs/tst.ftruncate.ksh
# jdtrace doesn't pull in library files?
common/pragma/tst.libdepfullyconnected.ksh

View File

@ -0,0 +1,60 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <alloca.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/systeminfo.h>
int
main(int argc, char **argv)
{
int i, ac, has64;
char **av, **p;
ac = argc + 3;
av = p = alloca(sizeof (char *) * ac);
*p++ = "java";
*p++ = "-jar";
*p++ = "/opt/SUNWdtrt/lib/java/jdtrace.jar";
argc--;
argv++;
for (i = 0; i < argc; i++) {
p[i] = argv[i];
}
p[i] = NULL;
(void) execvp(av[0], av);
perror("exec failed");
return (0);
}

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: JDTrace
Class-Path: /usr/share/lib/java/dtrace.jar

View File

@ -0,0 +1,236 @@
#!/usr/local/bin/perl
#
# CDDL HEADER START
#
# 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]
#
# CDDL HEADER END
#
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "%Z%%M% %I% %E% SMI"
require 5.6.1;
$PNAME = $0;
$PNAME =~ s:.*/::;
$USAGE = "Usage: $PNAME [file ...]\n";
$errs = 0;
sub err
{
my($msg) = @_;
print "$file: $lineno: $msg\n";
$errs++;
}
sub dstyle
{
open(FILE, "$file");
$lineno = 0;
$inclause = 0;
$skipnext = 0;
while (<FILE>) {
$lineno++;
chop;
if ($skipnext) {
$skipnext = 0;
next;
}
#
# Amazingly, some ident strings are longer than 80 characters!
#
if (/^#pragma ident/) {
next;
}
#
# The algorithm to calculate line length from cstyle.
#
$line = $_;
if ($line =~ tr/\t/\t/ * 7 + length($line) > 80) {
# yes, there is a chance.
# replace tabs with spaces and check again.
$eline = $line;
1 while $eline =~
s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
if (length($eline) > 80) {
err "line > 80 characters";
}
}
if (/\/\*DSTYLED\*\//) {
$skipnext = 1;
next;
}
if (/^#pragma/) {
next;
}
if (/^#include/) {
next;
}
#
# Before we do any more analysis, we want to prune out any
# quoted strings. This is a bit tricky because we need
# to be careful of backslashed quotes within quoted strings.
# I'm sure there is a very crafty way to do this with a
# single regular expression, but that will have to wait for
# somone with better regex juju that I; we do this by first
# eliminating the backslashed quotes, and then eliminating
# whatever quoted strings are left. Note that we eliminate
# the string by replacing it with "quotedstr"; this is to
# allow lines to end with a quoted string. (If we simply
# eliminated the quoted string, dstyle might complain about
# the line ending in a space or tab.)
#
s/\\\"//g;
s/\"[^\"]*\"/quotedstr/g;
if (/[ \t]$/) {
err "space or tab at end of line";
}
if (/^[\t]+[ ]+[\t]+/) {
err "spaces between tabs";
}
if (/^[\t]* \*/) {
next;
}
if (/^ /) {
err "indented by spaces not tabs";
}
if (/^{}$/) {
next;
}
if (!/^enum/ && !/^\t*struct/ && !/^\t*union/ && !/^typedef/ &&
!/^translator/ && !/^provider/) {
if (/[\w\s]+{/) {
err "left brace not on its own line";
}
if (/{[\w\s]+/) {
err "left brace not on its own line";
}
}
if (!/;$/) {
if (/[\w\s]+}/) {
err "right brace not on its own line";
}
if (/}[\w\s]+/) {
err "right brace not on its own line";
}
}
if (/^}/) {
$inclause = 0;
}
if (!$inclause && /^[\w ]+\//) {
err "predicate not at beginning of line";
}
if (!$inclause && /^\/[ \t]+\w/) {
err "space between '/' and expression in predicate";
}
if (!$inclause && /\w[ \t]+\/$/) {
err "space between expression and '/' in predicate";
}
if (!$inclause && /\s,/) {
err "space before comma in probe description";
}
if (!$inclause && /\w,[\w\s]/ && !/;$/) {
if (!/extern/ && !/\(/ && !/inline/) {
err "multiple probe descriptions on same line";
}
}
if ($inclause && /sizeof\(/) {
err "missing space after sizeof";
}
if ($inclause && /^[\w ]/) {
err "line doesn't begin with a tab";
}
if ($inclause && /,[\w]/) {
err "comma without trailing space";
}
if (/\w&&/ || /&&\w/ || /\w\|\|/ || /\|\|\w/) {
err "logical operator not set off with spaces";
}
#
# We want to catch "i<0" variants, but we don't want to
# erroneously flag translators.
#
if (!/\w<\w+>\(/) {
if (/\w>/ || / >\w/ || /\w</ || /<\w/) {
err "comparison operator not set " .
"off with spaces";
}
}
if (/\w==/ || /==\w/ || /\w<=/ || />=\w/ || /\w!=/ || /!=\w/) {
err "comparison operator not set off with spaces";
}
if (/\w=/ || /=\w/) {
err "assignment operator not set off with spaces";
}
if (/^{/) {
$inclause = 1;
}
}
}
foreach $arg (@ARGV) {
if (-f $arg) {
push(@files, $arg);
} else {
die "$PNAME: $arg is not a valid file\n";
}
}
die $USAGE if (scalar(@files) == 0);
foreach $file (@files) {
dstyle($file);
}
exit($errs != 0);

View File

@ -0,0 +1,703 @@
#!/usr/local/bin/perl
#
# CDDL HEADER START
#
# 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]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
require 5.6.1;
use File::Find;
use File::Basename;
use Getopt::Std;
use Cwd;
use Cwd 'abs_path';
$PNAME = $0;
$PNAME =~ s:.*/::;
$OPTSTR = 'abd:fghi:jlnqsx:';
$USAGE = "Usage: $PNAME [-abfghjlnqs] [-d dir] [-i isa] "
. "[-x opt[=arg]] [file | dir ...]\n";
($MACH = `uname -p`) =~ s/\W*\n//;
@dtrace_argv = ();
$ksh_path = '/bin/sh';
@files = ();
%exceptions = ();
%results = ();
$errs = 0;
#
# If no test files are specified on the command-line, execute a find on "."
# and append any tst.*.d, tst.*.ksh, err.*.d or drp.*.d files found within
# the directory tree.
#
sub wanted
{
push(@files, $File::Find::name)
if ($_ =~ /^(tst|err|drp)\..+\.(d|ksh)$/ && -f "$_");
}
sub dirname {
my($s) = @_;
my($i);
$s = substr($s, 0, $i) if (($i = rindex($s, '/')) != -1);
return $i == -1 ? '.' : $i == 0 ? '/' : $s;
}
sub usage
{
print $USAGE;
print "\t -a execute test suite using anonymous enablings\n";
print "\t -b execute bad ioctl test program\n";
print "\t -d specify directory for test results files and cores\n";
print "\t -g enable libumem debugging when running tests\n";
print "\t -f force bypassed tests to run\n";
print "\t -h display verbose usage message\n";
print "\t -i specify ISA to test instead of isaexec(3C) default\n";
print "\t -j execute test suite using jdtrace (Java API) only\n";
print "\t -l save log file of results and PIDs used by tests\n";
print "\t -n execute test suite using dtrace(1m) only\n";
print "\t -q set quiet mode (only report errors and summary)\n";
print "\t -s save results files even for tests that pass\n";
print "\t -x pass corresponding -x argument to dtrace(1M)\n";
exit(2);
}
sub errmsg
{
my($msg) = @_;
print STDERR $msg;
print LOG $msg if ($opt_l);
$errs++;
}
sub fail
{
my(@parms) = @_;
my($msg) = $parms[0];
my($errfile) = $parms[1];
my($n) = 0;
my($dest) = basename($file);
while (-d "$opt_d/failure.$n") {
$n++;
}
unless (mkdir "$opt_d/failure.$n") {
warn "ERROR: failed to make directory $opt_d/failure.$n: $!\n";
exit(125);
}
open(README, ">$opt_d/failure.$n/README");
print README "ERROR: " . $file . " " . $msg;
if (scalar @parms > 1) {
print README "; see $errfile\n";
} else {
if (-f "$opt_d/$pid.core") {
print README "; see $pid.core\n";
} else {
print README "\n";
}
}
close(README);
if (-f "$opt_d/$pid.out") {
rename("$opt_d/$pid.out", "$opt_d/failure.$n/$pid.out");
link("$file.out", "$opt_d/failure.$n/$dest.out");
}
if (-f "$opt_d/$pid.err") {
rename("$opt_d/$pid.err", "$opt_d/failure.$n/$pid.err");
link("$file.err", "$opt_d/failure.$n/$dest.err");
}
if (-f "$opt_d/$pid.core") {
rename("$opt_d/$pid.core", "$opt_d/failure.$n/$pid.core");
}
link("$file", "$opt_d/failure.$n/$dest");
$msg = "ERROR: " . $dest . " " . $msg;
if (scalar @parms > 1) {
$msg = $msg . "; see $errfile in failure.$n\n";
} else {
$msg = $msg . "; details in failure.$n\n";
}
errmsg($msg);
}
sub logmsg
{
my($msg) = @_;
print STDOUT $msg unless ($opt_q);
print LOG $msg if ($opt_l);
}
# Trim leading and trailing whitespace
sub trim {
my($s) = @_;
$s =~ s/^\s*//;
$s =~ s/\s*$//;
return $s;
}
# Load exception set of skipped tests from the file at the given
# pathname. The test names are assumed to be paths relative to $dt_tst,
# for example: common/aggs/tst.neglquant.d, and specify tests to be
# skipped.
sub load_exceptions {
my($listfile) = @_;
my($line) = "";
%exceptions = ();
if (length($listfile) > 0) {
exit(123) unless open(STDIN, "<$listfile");
while (<STDIN>) {
chomp;
$line = $_;
# line is non-empty and not a comment
if ((length($line) > 0) && ($line =~ /^\s*[^\s#]/ )) {
$exceptions{trim($line)} = 1;
}
}
}
}
# Return 1 if the test is found in the exception set, 0 otherwise.
sub is_exception {
my($file) = @_;
my($i) = -1;
if (scalar(keys(%exceptions)) == 0) {
return 0;
}
# hash absolute pathname after $dt_tst/
$file = abs_path($file);
$i = index($file, $dt_tst);
if ($i == 0) {
$file = substr($file, length($dt_tst) + 1);
return $exceptions{$file};
}
return 0;
}
#
# Iterate over the set of test files specified on the command-line or by
# a find on "$defdir/common" and "$defdir/$MACH" and execute each one.
# If the test file is executable, we fork and exec it. If the test is a
# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it.
# If the file is named tst.* we assume it should return exit status 0.
# If the file is named err.* we assume it should return exit status 1.
# If the file is named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and
# examine stderr to ensure that a matching error tag was produced.
# If the file is named drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and
# examine stderr to ensure that a matching drop tag was produced.
# If any *.out or *.err files are found we perform output comparisons.
#
# run_tests takes two arguments: The first is the pathname of the dtrace
# command to invoke when running the tests. The second is the pathname
# of a file (may be the empty string) listing tests that ought to be
# skipped (skipped tests are listed as paths relative to $dt_tst, for
# example: common/aggs/tst.neglquant.d).
#
sub run_tests {
my($dtrace, $exceptions_path) = @_;
my($passed) = 0;
my($bypassed) = 0;
my($failed) = $errs;
my($total) = 0;
die "$PNAME: $dtrace not found\n" unless (-x "$dtrace");
logmsg($dtrace . "\n");
load_exceptions($exceptions_path);
foreach $file (sort @files) {
$file =~ m:.*/((.*)\.(\w+)):;
$name = $1;
$base = $2;
$ext = $3;
$dir = dirname($file);
$isksh = 0;
$tag = 0;
$droptag = 0;
if ($name =~ /^tst\./) {
$isksh = ($ext eq 'ksh');
$status = 0;
} elsif ($name =~ /^err\.(D_[A-Z0-9_]+)\./) {
$status = 1;
$tag = $1;
} elsif ($name =~ /^err\./) {
$status = 1;
} elsif ($name =~ /^drp\.([A-Z0-9_]+)\./) {
$status = 0;
$droptag = $1;
} else {
errmsg("ERROR: $file is not a valid test file name\n");
next;
}
$fullname = "$dir/$name";
$exe = "./$base.exe";
$exe_pid = -1;
if ($opt_a && ($status != 0 || $tag != 0 || $droptag != 0 ||
-x $exe || $isksh || -x $fullname)) {
$bypassed++;
next;
}
if (!$opt_f && is_exception("$dir/$name")) {
$bypassed++;
next;
}
if (!$isksh && -x $exe) {
if (($exe_pid = fork()) == -1) {
errmsg(
"ERROR: failed to fork to run $exe: $!\n");
next;
}
if ($exe_pid == 0) {
open(STDIN, '</dev/null');
exec($exe);
warn "ERROR: failed to exec $exe: $!\n";
}
}
logmsg("testing $file ... ");
if (($pid = fork()) == -1) {
errmsg("ERROR: failed to fork to run test $file: $!\n");
next;
}
if ($pid == 0) {
open(STDIN, '</dev/null');
exit(125) unless open(STDOUT, ">$opt_d/$$.out");
exit(125) unless open(STDERR, ">$opt_d/$$.err");
unless (chdir($dir)) {
warn "ERROR: failed to chdir for $file: $!\n";
exit(126);
}
push(@dtrace_argv, '-xerrtags') if ($tag);
push(@dtrace_argv, '-xdroptags') if ($droptag);
push(@dtrace_argv, $exe_pid) if ($exe_pid != -1);
if ($isksh) {
exit(123) unless open(STDIN, "<$name");
exec("$ksh_path /dev/stdin $dtrace");
} elsif (-x $name) {
warn "ERROR: $name is executable\n";
exit(1);
} else {
if ($tag == 0 && $status == $0 && $opt_a) {
push(@dtrace_argv, '-A');
}
push(@dtrace_argv, '-C');
push(@dtrace_argv, '-s');
push(@dtrace_argv, $name);
exec($dtrace, @dtrace_argv);
}
warn "ERROR: failed to exec for $file: $!\n";
exit(127);
}
if (waitpid($pid, 0) == -1) {
errmsg("ERROR: timed out waiting for $file\n");
kill(9, $exe_pid) if ($exe_pid != -1);
kill(9, $pid);
next;
}
kill(9, $exe_pid) if ($exe_pid != -1);
if ($tag == 0 && $status == $0 && $opt_a) {
#
# We can chuck the earler output.
#
unlink($pid . '.out');
unlink($pid . '.err');
#
# This is an anonymous enabling. We need to get
# the module unloaded.
#
system("dtrace -ae 1> /dev/null 2> /dev/null");
system("svcadm disable -s " .
"svc:/network/nfs/mapid:default");
system("modunload -i 0 ; modunload -i 0 ; " .
"modunload -i 0");
if (!system("modinfo | grep dtrace")) {
warn "ERROR: couldn't unload dtrace\n";
system("svcadm enable " .
"-s svc:/network/nfs/mapid:default");
exit(124);
}
#
# DTrace is gone. Now update_drv(1M), and rip
# everything out again.
#
system("update_drv dtrace");
system("dtrace -ae 1> /dev/null 2> /dev/null");
system("modunload -i 0 ; modunload -i 0 ; " .
"modunload -i 0");
if (!system("modinfo | grep dtrace")) {
warn "ERROR: couldn't unload dtrace\n";
system("svcadm enable " .
"-s svc:/network/nfs/mapid:default");
exit(124);
}
#
# Now bring DTrace back in.
#
system("sync ; sync");
system("dtrace -l -n bogusprobe 1> /dev/null " .
"2> /dev/null");
system("svcadm enable -s " .
"svc:/network/nfs/mapid:default");
#
# That should have caused DTrace to reload with
# the new configuration file. Now we can try to
# snag our anonymous state.
#
if (($pid = fork()) == -1) {
errmsg("ERROR: failed to fork to run " .
"test $file: $!\n");
next;
}
if ($pid == 0) {
open(STDIN, '</dev/null');
exit(125) unless open(STDOUT, ">$opt_d/$$.out");
exit(125) unless open(STDERR, ">$opt_d/$$.err");
push(@dtrace_argv, '-a');
unless (chdir($dir)) {
warn "ERROR: failed to chdir " .
"for $file: $!\n";
exit(126);
}
exec($dtrace, @dtrace_argv);
warn "ERROR: failed to exec for $file: $!\n";
exit(127);
}
if (waitpid($pid, 0) == -1) {
errmsg("ERROR: timed out waiting for $file\n");
kill(9, $pid);
next;
}
}
logmsg("[$pid]\n");
$wstat = $?;
$wifexited = ($wstat & 0xFF) == 0;
$wexitstat = ($wstat >> 8) & 0xFF;
$wtermsig = ($wstat & 0x7F);
if (!$wifexited) {
fail("died from signal $wtermsig");
next;
}
if ($wexitstat == 125) {
die "$PNAME: failed to create output file in $opt_d " .
"(cd elsewhere or use -d)\n";
}
if ($wexitstat != $status) {
fail("returned $wexitstat instead of $status");
next;
}
if (-f "$file.out" &&
system("cmp -s $file.out $opt_d/$pid.out") != 0) {
fail("stdout mismatch", "$pid.out");
next;
}
if (-f "$file.err" &&
system("cmp -s $file.err $opt_d/$pid.err") != 0) {
fail("stderr mismatch: see $pid.err");
next;
}
if ($tag) {
open(TSTERR, "<$opt_d/$pid.err");
$tsterr = <TSTERR>;
close(TSTERR);
unless ($tsterr =~ /: \[$tag\] line \d+:/) {
fail("errtag mismatch: see $pid.err");
next;
}
}
if ($droptag) {
$found = 0;
open(TSTERR, "<$opt_d/$pid.err");
while (<TSTERR>) {
if (/\[$droptag\] /) {
$found = 1;
last;
}
}
close (TSTERR);
unless ($found) {
fail("droptag mismatch: see $pid.err");
next;
}
}
unless ($opt_s) {
unlink($pid . '.out');
unlink($pid . '.err');
}
}
if ($opt_a) {
#
# If we're running with anonymous enablings, we need to
# restore the .conf file.
#
system("dtrace -A 1> /dev/null 2> /dev/null");
system("dtrace -ae 1> /dev/null 2> /dev/null");
system("modunload -i 0 ; modunload -i 0 ; modunload -i 0");
system("update_drv dtrace");
}
$total = scalar(@files);
$failed = $errs - $failed;
$passed = ($total - $failed - $bypassed);
$results{$dtrace} = {
"passed" => $passed,
"bypassed" => $bypassed,
"failed" => $failed,
"total" => $total
};
}
die $USAGE unless (getopts($OPTSTR));
usage() if ($opt_h);
foreach $arg (@ARGV) {
if (-f $arg) {
push(@files, $arg);
} elsif (-d $arg) {
find(\&wanted, $arg);
} else {
die "$PNAME: $arg is not a valid file or directory\n";
}
}
$dt_tst = '/opt/SUNWdtrt/tst';
$dt_bin = '/opt/SUNWdtrt/bin';
$defdir = -d $dt_tst ? $dt_tst : '.';
$bindir = -d $dt_bin ? $dt_bin : '.';
find(\&wanted, "$defdir/common") if (scalar(@ARGV) == 0);
find(\&wanted, "$defdir/$MACH") if (scalar(@ARGV) == 0);
die $USAGE if (scalar(@files) == 0);
$dtrace_path = '/usr/sbin/dtrace';
$jdtrace_path = "$bindir/jdtrace";
%exception_lists = ("$jdtrace_path" => "$bindir/exception.lst");
if ($opt_j || $opt_n || $opt_i) {
@dtrace_cmds = ();
push(@dtrace_cmds, $dtrace_path) if ($opt_n);
push(@dtrace_cmds, $jdtrace_path) if ($opt_j);
push(@dtrace_cmds, "/usr/sbin/$opt_i/dtrace") if ($opt_i);
} else {
@dtrace_cmds = ($dtrace_path, $jdtrace_path);
}
if ($opt_d) {
die "$PNAME: -d arg must be absolute path\n" unless ($opt_d =~ /^\//);
die "$PNAME: -d arg $opt_d is not a directory\n" unless (-d "$opt_d");
system("coreadm -p $opt_d/%p.core");
} else {
my $dir = getcwd;
system("coreadm -p $dir/%p.core");
$opt_d = '.';
}
if ($opt_x) {
push(@dtrace_argv, '-x');
push(@dtrace_argv, $opt_x);
}
die "$PNAME: failed to open $PNAME.$$.log: $!\n"
unless (!$opt_l || open(LOG, ">$PNAME.$$.log"));
if ($opt_g) {
$ENV{'UMEM_DEBUG'} = 'default,verbose';
$ENV{'UMEM_LOGGING'} = 'fail,contents';
$ENV{'LD_PRELOAD'} = 'libumem.so';
}
#
# Ensure that $PATH contains a cc(1) so that we can execute the
# test programs that require compilation of C code.
#
#$ENV{'PATH'} = $ENV{'PATH'} . ':/ws/onnv-tools/SUNWspro/SS11/bin';
if ($opt_b) {
logmsg("badioctl'ing ... ");
if (($badioctl = fork()) == -1) {
errmsg("ERROR: failed to fork to run badioctl: $!\n");
next;
}
if ($badioctl == 0) {
open(STDIN, '</dev/null');
exit(125) unless open(STDOUT, ">$opt_d/$$.out");
exit(125) unless open(STDERR, ">$opt_d/$$.err");
exec($bindir . "/badioctl");
warn "ERROR: failed to exec badioctl: $!\n";
exit(127);
}
logmsg("[$badioctl]\n");
#
# If we're going to be bad, we're just going to iterate over each
# test file.
#
foreach $file (sort @files) {
($name = $file) =~ s:.*/::;
$dir = dirname($file);
if (!($name =~ /^tst\./ && $name =~ /\.d$/)) {
next;
}
logmsg("baddof'ing $file ... ");
if (($pid = fork()) == -1) {
errmsg("ERROR: failed to fork to run baddof: $!\n");
next;
}
if ($pid == 0) {
open(STDIN, '</dev/null');
exit(125) unless open(STDOUT, ">$opt_d/$$.out");
exit(125) unless open(STDERR, ">$opt_d/$$.err");
unless (chdir($dir)) {
warn "ERROR: failed to chdir for $file: $!\n";
exit(126);
}
exec($bindir . "/baddof", $name);
warn "ERROR: failed to exec for $file: $!\n";
exit(127);
}
sleep 60;
kill(9, $pid);
waitpid($pid, 0);
logmsg("[$pid]\n");
unless ($opt_s) {
unlink($pid . '.out');
unlink($pid . '.err');
}
}
kill(9, $badioctl);
waitpid($badioctl, 0);
unless ($opt_s) {
unlink($badioctl . '.out');
unlink($badioctl . '.err');
}
exit(0);
}
#
# Run all the tests specified on the command-line (the entire test suite
# by default) once for each dtrace command tested, skipping any tests
# not valid for that command.
#
foreach $dtrace_cmd (@dtrace_cmds) {
run_tests($dtrace_cmd, $exception_lists{$dtrace_cmd});
}
$opt_q = 0; # force final summary to appear regardless of -q option
logmsg("\n==== TEST RESULTS ====\n");
foreach $key (keys %results) {
my $passed = $results{$key}{"passed"};
my $bypassed = $results{$key}{"bypassed"};
my $failed = $results{$key}{"failed"};
my $total = $results{$key}{"total"};
logmsg("\n mode: " . $key . "\n");
logmsg(" passed: " . $passed . "\n");
if ($bypassed) {
logmsg(" bypassed: " . $bypassed . "\n");
}
logmsg(" failed: " . $failed . "\n");
logmsg(" total: " . $total . "\n");
}
exit($errs != 0);

View File

@ -0,0 +1,45 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* An aggregation must call an aggregating function.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@counts["xyz"] = breakpoint();
exit(0);
}

View File

@ -0,0 +1,45 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* An aggregation may not be used as a multi-dimensional array
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@counts[0][2] = count();
exit(0);
}

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* An aggregation must have an aggregating function applied.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1];
}

View File

@ -0,0 +1,45 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test redefining the aggregation
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a = count();
}
END
{
@a = max(0);
}

View File

@ -0,0 +1,43 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* avg() should not accept a non-scalar value
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a[pid] = avg(probefunc);
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* max() should not accept a non-scalar value
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[pid] = max(probefunc);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* min() should not accept a non-scalar value
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[pid] = min(probefunc);
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* quantize() should not accept a non-scalar value
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[pid] = quantize(probefunc);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* sum() should not accept a non-scalar value
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[pid] = sum(probefunc);
}

View File

@ -0,0 +1,77 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* The argument to clear() must be an aggregation.
*
* SECTION: Aggregations/Clearing aggregations
*
*
*/
#pragma D option quiet
#pragma D option aggrate=10ms
#pragma D option switchrate=10ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i%5] = sum(i * 100);
i++;
}
tick-100ms
/i == 10/
{
printf("Aggregation data before clear():\n");
printa(@func);
clear(count());
printf("Aggregation data after clear():\n");
printa(@func);
i++;
}
tick-100ms
/i == 20/
{
printf("Final aggregation data:\n");
printa(@func);
exit(0);
}

View File

@ -0,0 +1,77 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* clear() should handle no args as an error.
*
* SECTION: Aggregations/Clearing aggregations
*
*
*/
#pragma D option quiet
#pragma D option aggrate=10ms
#pragma D option switchrate=10ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i%5] = sum(i * 100);
i++;
}
tick-100ms
/i == 10/
{
printf("Aggregation data before clear():\n");
printa(@func);
clear();
printf("Aggregation data after clear():\n");
printa(@func);
i++;
}
tick-100ms
/i == 20/
{
printf("Final aggregation data:\n");
printa(@func);
exit(0);
}

View File

@ -0,0 +1,45 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* An aggregation must call an aggregating function, not a probe
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@counts[0][2] = tick-1();
exit(0);
}

View File

@ -0,0 +1,43 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test the use of a non-supported aggregate function.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@counts["badtest"] = foo();
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test using an aggregation in an expression context.
* This should result in a compile-time error.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
trace(@a + 3);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test the use of a dynamic expression as an aggregation key.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@t[i] = count();
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test compiling an aggregation statement that has no effect.
* This should result in a compile-time error.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a;
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test the use of a void expression as an aggregation key.
* This should result in a compile-time error.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1, (void)0] = count();
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test the use of a dynamic expression as an aggregation key.
* This should result in a compile-time error.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[0] = count();
@b[@a] = count();
}

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test the use of a dynamic expression as an aggregation key.
* This should result in a compile-time error.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[curpsinfo] = count();
}

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() lower bound around must be an integer constant
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
x = 'a';
@a[1] = lquantize(timestamp, x, 1000, 1);
}

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() lower bound around must be an integer constant
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
x = 'a';
@a[1] = lquantize(timestamp, x, 1000, 1);
}

View File

@ -0,0 +1,43 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() lower bound must be a 32-bit quantity
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = lquantize(timestamp, 2147483657, 1000, 1);
}

View File

@ -0,0 +1,45 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() upper bound around must be an integer constant
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
x = 'a';
@a[1] = lquantize(timestamp, 100, rand(), 1);
}

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() upper bound around must be an integer constant
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
x = 'a';
@a[1] = lquantize(timestamp, 100, 2147483657, 1);
}

View File

@ -0,0 +1,33 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
@ = lquantize(0, 10, 20, 1);
@ = lquantize(0, 15, 20, 1);
}

View File

@ -0,0 +1,33 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
@ = lquantize(0, 10, 20, 1);
@ = lquantize(0, 15, 30, 10);
}

View File

@ -0,0 +1,33 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
@ = lquantize(0, 10, 20, 1);
@ = lquantize(0, 10, 2000, 1);
}

View File

@ -0,0 +1,33 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
@ = lquantize(0, 10, 20, 1);
@ = lquantize(0, 10, 2000, 10);
}

View File

@ -0,0 +1,33 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
@ = lquantize(0, 10, 20, 1);
@ = lquantize(0, 10, 20, 2);
}

View File

@ -0,0 +1,55 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Upper bound must be greater than lower bound argument
*
* SECTION: Aggregations/Aggregations
*/
#pragma D option quiet
BEGIN
{
i = 0;
}
tick-1
/i < 1000/
{
@a[i] = lquantize(i, 1100, -100, -100 );
i += 100;
}
tick-1
/i == 1000/
{
exit(0);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() should not accept more than 4 arguments.
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = lquantize(1, 2, 3, 4, 5);
}

View File

@ -0,0 +1,55 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Number of quantization levels must be a 16-bit quantity
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
i = 0;
}
tick-10ms
/i < 1000/
{
@a[i] = lquantize(i, 0, 1000000, 10);
i += 100;
}
tick-10ms
/i == 1000/
{
exit(0);
}

View File

@ -0,0 +1,56 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Upper bound must be greater than lower bound argument
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
i = 0;
}
tick-1
/i < 1000/
{
@a[i] = lquantize(i, 0, 1100, -100);
i += 100;
}
tick-1
/i == 1000/
{
exit(0);
}

View File

@ -0,0 +1,56 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() step value should be a 16-bit quantity
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
i = 0;
}
tick-10ms
/i < 1000/
{
@a[i] = lquantize(i, 100, 1100, 200000 );
i += 100;
}
tick-10ms
/i == 1000/
{
exit(0);
}

View File

@ -0,0 +1,65 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* The first argument to normalize() should be an aggregation.
*
* SECTION: Aggregations/Clearing aggregations
*
*
*/
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=1ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i % 5] = sum(i * 100);
i++;
}
tick-100ms
/i == 20/
{
printf("normalized data:\n");
normalize(count(), 4);
exit(0);
}

View File

@ -0,0 +1,64 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* normalize() accepts 2 args - passing fewer is an error.
*
* SECTION: Aggregations/Clearing aggregations
*
*
*/
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=1ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i % 5] = sum(i * 100);
i++;
}
tick-100ms
/i == 20/
{
printf("normalized data:\n");
normalize(@func);
exit(0);
}

View File

@ -0,0 +1,64 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* The second argument to normalize() should be a scalar.
*
* SECTION: Aggregations/Clearing aggregations
*
*
*/
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=1ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i % 5] = sum(i * 100);
i++;
}
tick-100ms
/i == 20/
{
printf("normalized data:\n");
normalize(@func, "hello");
exit(0);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() should not accept a non-scalar value
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[pid] = lquantize(probefunc, probefunc, probefunc, probefunc);
}

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* avg() should not accept a call with no arguments
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a[1] = avg();
}

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* avg() should not more than one argument
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a[1] = avg(1, 2);
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* count() should not accept any arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a["badtest"] = count(1);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() should not accept a call with no arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = lquantize();
}

View File

@ -0,0 +1,40 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* lquantize() should not have more than five (!) arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@[1] = lquantize(10, 0, 100, 1, 10, 20);
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* max() should not accept a call with no arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = max();
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* max() should not more than one argument
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = max(1, 2);
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* min() should not accept a call with no arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = min();
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* min() should not more than one argument
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = min(1, 2);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* quantize() should not accept a call with no arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = quantize();
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* quantize() should not have more than two arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[1] = quantize(1, 2, 3);
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* sum() should not accept a call with no arguments
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[pid] = sum();
}

View File

@ -0,0 +1,41 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* sum() should not more than one argument
*
* SECTION: Aggregations/Aggregations
*
*/
BEGIN
{
@a[pid] = sum(1, 2);
}

View File

@ -0,0 +1,35 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
int i;
BEGIN
{
trunc(i);
exit(1);
}

View File

@ -0,0 +1,34 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
@[0] = count();
trunc(@, 10, 20);
exit(1);
}

View File

@ -0,0 +1,33 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
trunc();
exit(1);
}

View File

@ -0,0 +1,34 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
BEGIN
{
@[0] = count();
trunc(@, @);
exit(1);
}

View File

@ -0,0 +1,46 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#pragma D option quiet
int i;
tick-10ms
{
@ = quantize(1LL << i);
@ = quantize((1LL << i) + 1);
@ = quantize(-(1LL << i));
@ = quantize(-(1LL << i) - 1);
i++;
}
tick-10ms
/i == 64/
{
exit(0);
}

View File

@ -0,0 +1,131 @@
value ------------- Distribution ------------- count
-4611686018427387904 |@ 5
-2305843009213693952 | 2
-1152921504606846976 | 2
-576460752303423488 | 2
-288230376151711744 | 2
-144115188075855872 | 2
-72057594037927936 | 2
-36028797018963968 | 2
-18014398509481984 | 2
-9007199254740992 | 2
-4503599627370496 | 2
-2251799813685248 | 2
-1125899906842624 | 2
-562949953421312 | 2
-281474976710656 | 2
-140737488355328 | 2
-70368744177664 | 2
-35184372088832 | 2
-17592186044416 | 2
-8796093022208 | 2
-4398046511104 | 2
-2199023255552 | 2
-1099511627776 | 2
-549755813888 | 2
-274877906944 | 2
-137438953472 | 2
-68719476736 | 2
-34359738368 | 2
-17179869184 | 2
-8589934592 | 2
-4294967296 | 2
-2147483648 | 2
-1073741824 | 2
-536870912 | 2
-268435456 | 2
-134217728 | 2
-67108864 | 2
-33554432 | 2
-16777216 | 2
-8388608 | 2
-4194304 | 2
-2097152 | 2
-1048576 | 2
-524288 | 2
-262144 | 2
-131072 | 2
-65536 | 2
-32768 | 2
-16384 | 2
-8192 | 2
-4096 | 2
-2048 | 2
-1024 | 2
-512 | 2
-256 | 2
-128 | 2
-64 | 2
-32 | 2
-16 | 2
-8 | 2
-4 | 2
-2 | 3
-1 | 1
0 | 0
1 | 1
2 | 3
4 | 2
8 | 2
16 | 2
32 | 2
64 | 2
128 | 2
256 | 2
512 | 2
1024 | 2
2048 | 2
4096 | 2
8192 | 2
16384 | 2
32768 | 2
65536 | 2
131072 | 2
262144 | 2
524288 | 2
1048576 | 2
2097152 | 2
4194304 | 2
8388608 | 2
16777216 | 2
33554432 | 2
67108864 | 2
134217728 | 2
268435456 | 2
536870912 | 2
1073741824 | 2
2147483648 | 2
4294967296 | 2
8589934592 | 2
17179869184 | 2
34359738368 | 2
68719476736 | 2
137438953472 | 2
274877906944 | 2
549755813888 | 2
1099511627776 | 2
2199023255552 | 2
4398046511104 | 2
8796093022208 | 2
17592186044416 | 2
35184372088832 | 2
70368744177664 | 2
140737488355328 | 2
281474976710656 | 2
562949953421312 | 2
1125899906842624 | 2
2251799813685248 | 2
4503599627370496 | 2
9007199254740992 | 2
18014398509481984 | 2
36028797018963968 | 2
72057594037927936 | 2
144115188075855872 | 2
288230376151711744 | 2
576460752303423488 | 2
1152921504606846976 | 2
2305843009213693952 | 2
4611686018427387904 | 3

View File

@ -0,0 +1,57 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive avg() test
*
* SECTION: Aggregations/Aggregations
*
* NOTES: This is a simple verifiable positive test of the avg() function.
*/
#pragma D option quiet
BEGIN
{
i = 0;
}
tick-10ms
/i < 1000/
{
@a = avg(i);
i += 100;
}
tick-10ms
/i == 1000/
{
exit(0);
}

View File

@ -0,0 +1,46 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive avg() test using negative values
*
* SECTION: Aggregations/Aggregations
*
* NOTES: This is a simple verifiable positive test of the avg() function.
*/
#pragma D option quiet
BEGIN
{
@ = avg(0);
@ = avg(-900);
exit(0);
}

View File

@ -0,0 +1,75 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive test for clearing aggregations
*
* SECTION: Aggregations/Clearing aggregations
*
*
*/
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=50ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i%5] = sum(i * 100);
i++;
}
tick-100ms
/i == 10/
{
printf("Aggregation data before clear():\n");
printa(@func);
clear(@func);
printf("Aggregation data after clear():\n");
printa(@func);
i++;
}
tick-100ms
/i == 20/
{
printf("Final aggregation data:\n");
printa(@func);
exit(0);
}

View File

@ -0,0 +1,22 @@
Aggregation data before clear():
0 500
1 700
2 900
3 1100
4 1300
Aggregation data after clear():
0 0
1 0
2 0
3 0
4 0
Final aggregation data:
0 1500
1 2700
2 2900
3 3100
4 3300

View File

@ -0,0 +1,60 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive avg() test
*
* SECTION: Aggregations/Aggregations
*
* NOTES:
* Verifies that printing a clear()'d aggregation with an avg()
* aggregation function doesn't cause problems.
*
*/
#pragma D option quiet
tick-10ms
/i++ < 5/
{
@a = avg(timestamp);
}
tick-10ms
/i == 5/
{
exit(2);
}
END
{
clear(@a);
exit(0);
}

View File

@ -0,0 +1,63 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive avg() test
*
* SECTION: Aggregations/Aggregations
*
* NOTES:
* Verifies that printing a clear()'d aggregation with an avg()
* aggregation function of 0 doesn't cause divide-by-zero problems.
*
*/
#pragma D option quiet
#pragma D option switchrate=50ms
#pragma D option aggrate=1ms
tick-100ms
/(x++ % 5) == 0/
{
@time = avg(0);
}
tick-100ms
/x > 5 && x <= 20/
{
printa(" %@d\n", @time);
clear(@time);
}
tick-100ms
/x > 20/
{
exit(0);
}

View File

@ -0,0 +1,16 @@
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

View File

@ -0,0 +1,78 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Denormalized aggregations can be cleared
*
* SECTION: Aggregations/Normalization;
* Aggregations/Clearing aggregations
*
*/
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=50ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i != 10 || i != 20/
{
@func[i%5] = sum(i * 100);
i++;
}
tick-100ms
/i == 10/
{
printf("Denormalized data before clear:\n");
denormalize(@func);
printa(@func);
clear(@func);
printf("Aggregation data after clear:\n");
printa(@func);
i++
}
tick-100ms
/i == 20/
{
printf("Final (denormalized) aggregation data:\n");
denormalize(@func);
printa(@func);
exit(0);
}

View File

@ -0,0 +1,22 @@
Denormalized data before clear:
0 500
1 700
2 900
3 1100
4 1300
Aggregation data after clear:
0 0
1 0
2 0
3 0
4 0
Final (denormalized) aggregation data:
0 1500
1 2700
2 2900
3 3100
4 3300

View File

@ -0,0 +1,67 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive lquantize()/clear() test
*
* SECTION: Aggregations/Aggregations
*
* NOTES:
* Verifies that printing a clear()'d aggregation with an lquantize()
* aggregation function doesn't cause problems.
*
*/
#pragma D option switchrate=50ms
#pragma D option aggrate=1ms
#pragma D option quiet
tick-100ms
{
x++;
@a["linear"] = lquantize(x, 0, 100, 1);
@b["exp"] = quantize(x);
}
tick-100ms
/(x % 5) == 0 && y++ < 5/
{
printa(@a);
printa(@b);
clear(@a);
clear(@b);
}
tick-100ms
/(x % 5) == 0 && y == 5/
{
exit(0);
}

View File

@ -0,0 +1,94 @@
linear
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@ 1
2 |@@@@@@@@ 1
3 |@@@@@@@@ 1
4 |@@@@@@@@ 1
5 |@@@@@@@@ 1
6 | 0
exp
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@ 1
2 |@@@@@@@@@@@@@@@@ 2
4 |@@@@@@@@@@@@@@@@ 2
8 | 0
linear
value ------------- Distribution ------------- count
5 | 0
6 |@@@@@@@@ 1
7 |@@@@@@@@ 1
8 |@@@@@@@@ 1
9 |@@@@@@@@ 1
10 |@@@@@@@@ 1
11 | 0
exp
value ------------- Distribution ------------- count
2 | 0
4 |@@@@@@@@@@@@@@@@ 2
8 |@@@@@@@@@@@@@@@@@@@@@@@@ 3
16 | 0
linear
value ------------- Distribution ------------- count
10 | 0
11 |@@@@@@@@ 1
12 |@@@@@@@@ 1
13 |@@@@@@@@ 1
14 |@@@@@@@@ 1
15 |@@@@@@@@ 1
16 | 0
exp
value ------------- Distribution ------------- count
4 | 0
8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5
16 | 0
linear
value ------------- Distribution ------------- count
15 | 0
16 |@@@@@@@@ 1
17 |@@@@@@@@ 1
18 |@@@@@@@@ 1
19 |@@@@@@@@ 1
20 |@@@@@@@@ 1
21 | 0
exp
value ------------- Distribution ------------- count
8 | 0
16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5
32 | 0
linear
value ------------- Distribution ------------- count
20 | 0
21 |@@@@@@@@ 1
22 |@@@@@@@@ 1
23 |@@@@@@@@ 1
24 |@@@@@@@@ 1
25 |@@@@@@@@ 1
26 | 0
exp
value ------------- Distribution ------------- count
8 | 0
16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5
32 | 0

View File

@ -0,0 +1,77 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Normalized aggregation data can be cleared
*
* SECTION: Aggregations/Normalization;
* Aggregations/Clearing aggregations
*
*/
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=50ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i % 5] = sum(i * 100);
i++;
}
tick-100ms
/i == 10/
{
printf("Normalized data before clear:\n");
normalize(@func, 5);
printa(@func);
clear(@func);
printf("Aggregation data after clear:\n");
printa(@func);
i++
}
tick-100ms
/i == 20/
{
printf("Final (normalized) aggregation data:\n");
normalize(@func, 5);
printa(@func);
exit(0);
}

View File

@ -0,0 +1,22 @@
Normalized data before clear:
0 100
1 140
2 180
3 220
4 260
Aggregation data after clear:
0 0
1 0
2 0
3 0
4 0
Final (normalized) aggregation data:
0 300
1 540
2 580
3 620
4 660

View File

@ -0,0 +1,44 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Postive count() test
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a = count();
@a = count();
exit(0);
}

View File

@ -0,0 +1,54 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive count() test
*
* SECTION: Aggregations/Aggregations
*/
#pragma D option quiet
BEGIN
{
i = 0;
}
tick-10ms
/i != 10/
{
i++;
@counts["tick-count"] = count();
}
tick-10ms
/i == 10/
{
exit(0);
}

View File

@ -0,0 +1,2 @@
tick-count 10

View File

@ -0,0 +1,56 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Test multiple count() calls.
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
i = 0;
}
tick-10ms
/i != 10/
{
i++;
@counts1[execname] = count();
@counts2[execname, arg0] = count();
}
tick-10ms
/i == 10/
{
exit(0);
}

View File

@ -0,0 +1,63 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Simple denormalization test
*
* SECTION: Aggregations/Normalization
*
*/
#pragma D option quiet
BEGIN
{
i = 0;
start = timestamp;
}
tick-10ms
/i < 20/
{
@func[i % 5] = sum(i * 100);
i++;
}
tick-10ms
/i == 20/
{
normalize(@func, 5);
printf("denormalized:");
denormalize(@func);
printa(@func);
exit(0);
}

View File

@ -0,0 +1,7 @@
denormalized:
0 3000
1 3400
2 3800
3 4200
4 4600

View File

@ -0,0 +1,61 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* denormalize() should work even if normalize() isn't called.
*
* SECTION: Aggregations/Normalization
*
*
*/
#pragma D option quiet
BEGIN
{
i = 0;
start = timestamp;
}
tick-10ms
/i < 20/
{
@func[i%5] = sum(i * 100);
i++;
}
tick-10ms
/i == 20/
{
printf("denormalized:");
denormalize(@func);
exit(0);
}

View File

@ -0,0 +1,6 @@
denormalized:
0 3000
1 3400
2 3800
3 4200
4 4600

View File

@ -0,0 +1,61 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive test for normalization() with printa()
*
* SECTION: Aggregations/Normalization
*
*/
#pragma D option quiet
#pragma D option aggrate=1ms
#pragma D option switchrate=50ms
BEGIN
{
i = 0;
start = timestamp;
}
tick-100ms
/i < 20/
{
@func[i % 5] = sum(i * 100);
i++;
}
tick-100ms
/i == 20/
{
printf("normalized data:\n");
normalize(@func, 5);
printa("%u %@u\n", @func);
exit(0);
}

View File

@ -0,0 +1,7 @@
normalized data:
0 600
1 680
2 760
3 840
4 920

View File

@ -0,0 +1,53 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive aggregation test
*
* SECTION: Aggregations/Aggregations
*
*/
#pragma D option quiet
BEGIN
{
@a = count();
@b = max(1);
@c[0] = count();
@d[0] = max(1);
printa("\n@a = %@u\n", @a);
printa("@b = %@u\n", @b);
printa("@c = %@u\n", @c);
printa("@d = %@u\n", @d);
exit(0);
}

View File

@ -0,0 +1,6 @@
@a = 1
@b = 1
@c = 1
@d = 1

View File

@ -0,0 +1,55 @@
/*
* CDDL HEADER START
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Positive aggregation key test
*
* SECTION: Aggregations/Aggregations
*/
#pragma D option quiet
BEGIN
{
i = 0;
}
tick-10ms
/i != 5/
{
i++;
@counts[execname, pid, id, tid, arg0, vtimestamp ] = count();
}
tick-10ms
/i == 5/
{
exit(0);
}

Some files were not shown because too many files have changed in this diff Show More