summaryrefslogtreecommitdiffstats
path: root/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo')
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile167
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d44
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d45
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d52
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d51
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/lquantize.d30
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/normalize.d49
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/renormalize.d43
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d46
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d30
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmd.d30
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmdfd.d30
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetime.d37
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetimeq.d37
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/chapters125
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d42
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d35
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d30
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d31
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d50
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/countdown.d43
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/counter.d44
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d31
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/trussrw.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d32
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d65
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d66
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d47
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d52
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d45
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d284
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/whatlock.d37
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl227
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d35
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/progtime.d37
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d51
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d39
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/profpri.d31
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/restest.d45
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/firebird.d52
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/howlong.d42
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d45
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d31
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pritime.d44
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d37
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d31
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/ticktime.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whatfor.d64
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d37
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whererun.d60
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d46
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whopreempt.d57
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whoqueue.d95
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whosteal.d40
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d44
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d40
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/interp.d33
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/syscall.d31
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/tracewrite.d32
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d54
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d37
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/specopen.d93
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d44
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d55
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/rwinfo.d59
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d45
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/Makefile.kup0
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d37
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d36
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d45
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpconnlat.d37
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d32
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpioflags.d64
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d78
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d39
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d138
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/Makefile.kup0
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d36
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytesstat.d45
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d32
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d59
-rwxr-xr-xsrc/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d133
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d38
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/errorpath.d52
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d30
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/userfunc.d42
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d55
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d43
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/Makefile.kup0
-rw-r--r--src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/soffice.d52
125 files changed, 5163 insertions, 0 deletions
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile
new file mode 100644
index 00000000..7da281ed
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile
@@ -0,0 +1,167 @@
+#
+# 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) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+include ../../Makefile.cmd
+
+i386_DFILES = \
+ iprb.d
+
+DFILES = \
+ applicat.d \
+ badopen.d \
+ begin.d \
+ callout.d \
+ clause.d \
+ clear.d \
+ countdown.d \
+ counter.d \
+ dateprof.d \
+ delay.d \
+ denorm.d \
+ end.d \
+ error.d \
+ errorpath.d \
+ find.d \
+ firebird.d \
+ hello.d \
+ howlong.d \
+ interp.d \
+ interval.d \
+ intr.d \
+ iocpu.d \
+ iosnoop.d \
+ iothrough.d \
+ iotime.d \
+ ipio.d \
+ ipproto.d \
+ tcprst.d \
+ kstat.d \
+ ksyms.d \
+ libc.d \
+ lquantize.d \
+ lwptime.d \
+ normalize.d \
+ nscd.d \
+ pri.d \
+ printa.d \
+ pritime.d \
+ prof.d \
+ profpri.d \
+ progtime.d \
+ putnext.d \
+ qlen.d \
+ qtime.d \
+ renormalize.d \
+ restest.d \
+ ring.d \
+ rtime.d \
+ rwinfo.d \
+ rwtime.d \
+ sig.d \
+ soffice.d \
+ spec.d \
+ specopen.d \
+ ssd.d \
+ syscall.d \
+ tcp1stbyte.d \
+ tcpbytes.d \
+ tcpbytesstat.d \
+ tcpconnlat.d \
+ tcpio.d \
+ tcpioflags.d \
+ tcpsnoop.d \
+ tcpstate.d \
+ tcptop.d \
+ tick.d \
+ ticktime.d \
+ time.d \
+ tracewrite.d \
+ trunc.d \
+ trussrw.d \
+ udpbytes.d \
+ udpbytesstat.d \
+ udpio.d \
+ udpsnoop.d \
+ udptop.d \
+ userfunc.d \
+ whatfor.d \
+ whatlock.d \
+ where.d \
+ whererun.d \
+ whoexec.d \
+ whofor.d \
+ whoio.d \
+ whopreempt.d \
+ whoqueue.d \
+ whosteal.d \
+ whowrite.d \
+ writes.d \
+ writesbycmd.d \
+ writesbycmdfd.d \
+ writetime.d \
+ writetimeq.d \
+ xioctl.d \
+ xterm.d \
+ xwork.d \
+ $($(MACH)_DFILES)
+
+HTMLFILES = index.html
+
+DEMOFILES = \
+ $(DFILES) \
+ $(HTMLFILES) \
+ sunlogo.gif
+
+MKDEMO = mkdemo
+CLEANFILES += $(DFILES) $(MKDEMO)
+
+ROOTDEMODIR = $(ROOT)/usr/demo/dtrace
+ROOTDEMOFILES = $(DEMOFILES:%=$(ROOTDEMODIR)/%)
+
+all: $(DEMOFILES)
+
+clobber clean:
+ -$(RM) $(CLEANFILES)
+
+clean.lint install_h lint:
+
+install: $(ROOTDEMOFILES)
+
+$(ROOTDEMODIR):
+ $(INS.dir)
+
+$(ROOTDEMODIR)/%: %
+ $(INS.file)
+
+$(HTMLFILES): $(DFILES) $(MKDEMO)
+ ./$(MKDEMO) $@
+
+$(DFILES): $(MKDEMO)
+ ./$(MKDEMO) $@
+
+$(ROOTDEMOFILES): $(ROOTDEMODIR)
+
+$(ROOTDEMODIR) := DIRMODE = 755
+
+$(ROOTDEMOFILES) := FILEMODE = 644
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d
new file mode 100644
index 00000000..b7afd4cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option switchrate=5sec
+
+tick-1sec
+/n++ < 5/
+{
+ printf("walltime : %Y\n", walltimestamp);
+ printf("date : ");
+ system("date");
+ printf("\n");
+}
+
+tick-1sec
+/n == 5/
+{
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d
new file mode 100644
index 00000000..4b90a09a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ last = timestamp;
+}
+
+syscall:::entry
+{
+ @func[execname] = count();
+}
+
+tick-10sec
+{
+ normalize(@func, (timestamp - last) / 1000000000);
+ printa(@func);
+ clear(@func);
+ last = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d
new file mode 100644
index 00000000..19a63c5e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::exec:return,
+syscall::exece:return
+/execname == "date"/
+{
+ self->start = vtimestamp;
+}
+
+syscall:::entry
+/self->start/
+{
+ /*
+ * We linearly quantize on the current virtual time minus our
+ * process's start time. We divide by 1000 to yield microseconds
+ * rather than nanoseconds. The range runs from 0 to 10 milliseconds
+ * in steps of 100 microseconds; we expect that no date(1) process
+ * will take longer than 10 milliseconds to complete.
+ */
+ @["system calls over time"] =
+ lquantize((vtimestamp - self->start) / 1000, 0, 10000, 100);
+}
+
+syscall::rexit:entry
+/self->start/
+{
+ self->start = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d
new file mode 100644
index 00000000..6e58596f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ start = timestamp;
+}
+
+syscall:::entry
+{
+ @func[execname] = count();
+}
+
+END
+{
+ this->seconds = (timestamp - start) / 1000000000;
+ printf("Ran for %d seconds.\n", this->seconds);
+
+ printf("Per-second rate:\n");
+ normalize(@func, this->seconds);
+ printa(@func);
+
+ printf("\nRaw counts:\n");
+ denormalize(@func);
+ printa(@func);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/lquantize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/lquantize.d
new file mode 100644
index 00000000..833c73ac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/lquantize.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+ @fds[execname] = lquantize(arg0, 0, 100, 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/normalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/normalize.d
new file mode 100644
index 00000000..cce12027
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/normalize.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ /*
+ * Get the start time, in nanoseconds.
+ */
+ start = timestamp;
+}
+
+syscall:::entry
+{
+ @func[execname] = count();
+}
+
+END
+{
+ /*
+ * Normalize the aggregation based on the number of seconds we have
+ * been running. (There are 1,000,000,000 nanoseconds in one second.)
+ */
+ normalize(@func, (timestamp - start) / 1000000000);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/renormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/renormalize.d
new file mode 100644
index 00000000..a6a15107
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/renormalize.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ start = timestamp;
+}
+
+syscall:::entry
+{
+ @func[execname] = count();
+}
+
+tick-10sec
+{
+ normalize(@func, (timestamp - start) / 1000000000);
+ printa(@func);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d
new file mode 100644
index 00000000..76965f8b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ last = timestamp;
+}
+
+syscall:::entry
+{
+ @func[execname] = count();
+}
+
+tick-10sec
+{
+ trunc(@func, 10);
+ normalize(@func, (timestamp - last) / 1000000000);
+ printa(@func);
+ clear(@func);
+ last = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d
new file mode 100644
index 00000000..9de61541
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+ @counts["write system calls"] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmd.d
new file mode 100644
index 00000000..bcbefae1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmd.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+ @counts[execname] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmdfd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmdfd.d
new file mode 100644
index 00000000..8b92cb83
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmdfd.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+ @counts[execname, arg0] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetime.d
new file mode 100644
index 00000000..b770f5b0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetime.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+ self->ts = timestamp;
+}
+
+syscall::write:return
+/self->ts/
+{
+ @time[execname] = avg(timestamp - self->ts);
+ self->ts = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetimeq.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetimeq.d
new file mode 100644
index 00000000..9b494090
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetimeq.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+ self->ts = timestamp;
+}
+
+syscall::write:return
+/self->ts/
+{
+ @time[execname] = quantize(timestamp - self->ts);
+ self->ts = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d
new file mode 100644
index 00000000..f73f6a73
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt::iprbattach:entry
+{
+ self->trace = 1;
+}
+
+fbt:::
+/self->trace/
+{}
+
+fbt::iprbattach:return
+{
+ self->trace = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d
new file mode 100644
index 00000000..116bbd41
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option bufpolicy=ring
+#pragma D option bufsize=16k
+
+syscall:::entry
+/execname == $1/
+{
+ trace(timestamp);
+}
+
+syscall::rexit:entry
+{
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/chapters b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/chapters
new file mode 100644
index 00000000..2160a0cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/chapters
@@ -0,0 +1,125 @@
+name: book
+title: Solaris Dynamic Tracing Guide
+index: 0
+url: http://wikis.sun.com/display/DTrace/Documentation
+
+name: act
+title: Actions and Subroutines
+index: 10
+url: http://wikis.sun.com/display/DTrace/Actions+and+Subroutines
+
+name: agg
+title: Aggregations
+index: 9
+url: http://wikis.sun.com/display/DTrace/Aggregations
+
+name: anon
+title: Anonymous Tracing
+index: 34
+url: http://wikis.sun.com/display/DTrace/Anonymous+Tracing
+
+name: buf
+title: Buffers and Buffering
+index: 11
+url: http://wikis.sun.com/display/DTrace/Buffers+and+Buffering
+
+name: dtrace
+title: dtrace Provider
+index: 17
+url: http://wikis.sun.com/display/DTrace/dtrace+Provider
+
+name: fbt
+title: fbt Provider
+index: 20
+url: http://wikis.sun.com/display/DTrace/fbt+Provider
+
+name: intro
+title: Introduction
+index: 1
+url: http://wikis.sun.com/display/DTrace/Introduction
+
+name: io
+title: io Provider
+index: 27
+url: http://wikis.sun.com/display/DTrace/io+Provider
+
+name: lockstat
+title: lockstat Provider
+index: 18
+url: http://wikis.sun.com/display/DTrace/lockstat+Provider
+
+name: out
+title: Output Formatting
+index: 12
+url: http://wikis.sun.com/display/DTrace/Output+Formatting
+
+name: proc
+title: proc Provider
+index: 25
+url: http://wikis.sun.com/display/DTrace/proc+Provider
+
+name: profile
+title: profile Provider
+index: 19
+url: http://wikis.sun.com/display/DTrace/profile+Provider
+
+name: sched
+title: sched Provider
+index: 26
+url: http://wikis.sun.com/display/DTrace/sched+Provider
+
+name: script
+title: Scripting
+index: 15
+url: http://wikis.sun.com/display/DTrace/Scripting
+
+name: sdt
+title: sdt Provider
+index: 22
+url: http://wikis.sun.com/display/DTrace/sdt+Provider
+
+name: spec
+title: Speculative Tracing
+index: 13
+url: http://wikis.sun.com/display/DTrace/Speculative+Tracing
+
+name: struct
+title: Structs and Unions
+index: 7
+url: http://wikis.sun.com/display/DTrace/Structs+and+Unions
+
+name: sysinfo
+title: sysinfo Provider
+index: 23
+url: http://wikis.sun.com/display/DTrace/sysinfo+Provider
+
+name: user
+title: User Process Tracing
+index: 32
+url: http://wikis.sun.com/display/DTrace/User+Process+Tracing
+
+name: vars
+title: Variables
+index: 3
+url: http://wikis.sun.com/display/DTrace/Variables
+
+name: vminfo
+title: vminfo Provider
+index: 24
+url: http://wikis.sun.com/display/DTrace/vminfo+Provider
+
+name: ip
+title: ip Provider
+index: 101
+url: http://wikis.sun.com/display/DTrace/ip+Provider
+
+name: tcp
+title: tcp Provider
+index: 102
+url: http://wikis.sun.com/display/DTrace/tcp+Provider
+
+name: udp
+title: udp Provider
+index: 103
+url: http://wikis.sun.com/display/DTrace/udp+Provider
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d
new file mode 100644
index 00000000..a3786017
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+ prot[0] = "---";
+ prot[1] = "r--";
+ prot[2] = "-w-";
+ prot[3] = "rw-";
+ prot[4] = "--x";
+ prot[5] = "r-x";
+ prot[6] = "-wx";
+ prot[7] = "rwx";
+}
+
+syscall::mmap:entry
+{
+ printf("mmap with prot = %s", prot[arg2 & 0x7]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d
new file mode 100644
index 00000000..4390b10a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+ start = timestamp;
+}
+
+/*
+ * ... other tracing actions...
+ */
+
+END
+{
+ printf("total time: %d secs", (timestamp - start) / 1000000000);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d
new file mode 100644
index 00000000..97115763
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+ *(char *)NULL;
+}
+
+ERROR
+{
+ printf("Hit an error!");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d
new file mode 100644
index 00000000..1a523336
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt::delay:entry,
+fbt::drv_usecwait:entry
+{
+ self->in = timestamp
+}
+
+fbt::delay:return,
+fbt::drv_usecwait:return
+/self->in/
+{
+ @snoozers[stack()] = quantize(timestamp - self->in);
+ self->in = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d
new file mode 100644
index 00000000..dd91ea06
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt::putnext:entry
+{
+ @calls[stringof(args[0]->q_qinfo->qi_minfo->mi_idname)] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d
new file mode 100644
index 00000000..6b78ab9d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt:ssd::return
+/arg1 == EIO/
+{
+ printf("%s+%x returned EIO.", probefunc, arg0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d
new file mode 100644
index 00000000..33147682
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * To make the output more readable, we want to indent every function entry
+ * (and unindent every function return). This is done by setting the
+ * "flowindent" option.
+ */
+#pragma D option flowindent
+
+syscall::ioctl:entry
+/execname == "xclock" && guard++ == 0/
+{
+ self->traceme = 1;
+ printf("fd: %d", arg0);
+}
+
+fbt:::
+/self->traceme/
+{}
+
+syscall::ioctl:return
+/self->traceme/
+{
+ self->traceme = 0;
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/countdown.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/countdown.d
new file mode 100644
index 00000000..3fdb7904
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/countdown.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+dtrace:::BEGIN
+{
+ i = 10;
+}
+
+profile:::tick-1sec
+/i > 0/
+{
+ trace(i--);
+}
+
+profile:::tick-1sec
+/i == 0/
+{
+ trace("blastoff!");
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/counter.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/counter.d
new file mode 100644
index 00000000..bda153a8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/counter.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Count off and report the number of seconds elapsed
+ */
+dtrace:::BEGIN
+{
+ i = 0;
+}
+
+profile:::tick-1sec
+{
+ i = i + 1;
+ trace(i);
+}
+
+dtrace:::END
+{
+ trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d
new file mode 100644
index 00000000..b5842915
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+ trace("hello, world");
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d
new file mode 100644
index 00000000..c005fbc4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::read:entry,
+syscall::write:entry
+/pid == $1/
+{
+ ts[probefunc] = timestamp;
+}
+
+syscall::read:return,
+syscall::write:return
+/pid == $1 && ts[probefunc] != 0/
+{
+ printf("%d nsecs", timestamp - ts[probefunc]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/trussrw.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/trussrw.d
new file mode 100644
index 00000000..590782f2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/trussrw.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::read:entry,
+syscall::write:entry
+/pid == $1/
+{
+ printf("%s(%d, 0x%x, %4d)", probefunc, arg0, arg1, arg2);
+}
+
+syscall::read:return, syscall::write:return
+/pid == $1/
+{
+ printf("\t\t = %d\n", arg1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d
new file mode 100644
index 00000000..44bce364
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+io:::start
+/execname == "soffice.bin" && args[2]->fi_name == "applicat.rdb"/
+{
+ @ = lquantize(args[2]->fi_offset != -1 ?
+ args[2]->fi_offset / (1000 * 1024) : -1, 0, 1000);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d
new file mode 100644
index 00000000..6957071c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::on-cpu
+/execname == "soffice.bin"/
+{
+ self->on = vtimestamp;
+}
+
+sched:::off-cpu
+/self->on/
+{
+ @time["<on cpu>"] = sum(vtimestamp - self->on);
+ self->on = 0;
+}
+
+io:::wait-start
+/execname == "soffice.bin"/
+{
+ self->wait = timestamp;
+}
+
+io:::wait-done
+/self->wait/
+{
+ @io[args[2]->fi_name] = sum(timestamp - self->wait);
+ @time["<I/O wait>"] = sum(timestamp - self->wait);
+ self->wait = 0;
+}
+
+END
+{
+ printf("Time breakdown (milliseconds):\n");
+ normalize(@time, 1000000);
+ printa(" %-50s %15@d\n", @time);
+
+ printf("\nI/O wait breakdown (milliseconds):\n");
+ normalize(@io, 1000000);
+ printa(" %-50s %15@d\n", @io);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d
new file mode 100644
index 00000000..1db6290c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("%10s %58s %2s\n", "DEVICE", "FILE", "RW");
+}
+
+io:::start
+{
+ printf("%10s %58s %2s\n", args[1]->dev_statname,
+ args[2]->fi_pathname, args[0]->b_flags & B_READ ? "R" : "W");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d
new file mode 100644
index 00000000..b5b2e7e3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+io:::start
+{
+ start[args[0]->b_edev, args[0]->b_blkno] = timestamp;
+}
+
+io:::done
+/start[args[0]->b_edev, args[0]->b_blkno]/
+{
+ /*
+ * We want to get an idea of our throughput to this device in KB/sec.
+ * What we have, however, is nanoseconds and bytes. That is we want
+ * to calculate:
+ *
+ * bytes / 1024
+ * ------------------------
+ * nanoseconds / 1000000000
+ *
+ * But we can't calculate this using integer arithmetic without losing
+ * precision (the denomenator, for one, is between 0 and 1 for nearly
+ * all I/Os). So we restate the fraction, and cancel:
+ *
+ * bytes 1000000000 bytes 976562
+ * --------- * ------------- = --------- * -------------
+ * 1024 nanoseconds 1 nanoseconds
+ *
+ * This is easy to calculate using integer arithmetic; this is what
+ * we do below.
+ */
+ this->elapsed = timestamp - start[args[0]->b_edev, args[0]->b_blkno];
+ @[args[1]->dev_statname, args[1]->dev_pathname] =
+ quantize((args[0]->b_bcount * 976562) / this->elapsed);
+ start[args[0]->b_edev, args[0]->b_blkno] = 0;
+}
+
+END
+{
+ printa(" %s (%s)\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d
new file mode 100644
index 00000000..0e0f6ac7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d
@@ -0,0 +1,47 @@
+/*
+ * 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 D option quiet
+
+BEGIN
+{
+ printf("%10s %58s %2s %7s\n", "DEVICE", "FILE", "RW", "MS");
+}
+
+io:::start
+{
+ start[args[0]->b_edev, args[0]->b_blkno] = timestamp;
+}
+
+io:::done
+/start[args[0]->b_edev, args[0]->b_blkno]/
+{
+ this->elapsed = timestamp - start[args[0]->b_edev, args[0]->b_blkno];
+ printf("%10s %58s %2s %3d.%03d\n", args[1]->dev_statname,
+ args[2]->fi_pathname, args[0]->b_flags & B_READ ? "R" : "W",
+ this->elapsed / 1000000, (this->elapsed / 1000) % 1000);
+ start[args[0]->b_edev, args[0]->b_blkno] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d
new file mode 100644
index 00000000..f660b343
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+io:::start
+{
+ @[args[1]->dev_statname, execname, pid] = sum(args[0]->b_bcount);
+}
+
+END
+{
+ printf("%10s %20s %10s %15s\n", "DEVICE", "APP", "PID", "BYTES");
+ printa("%10s %20s %10d %15@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d
new file mode 100644
index 00000000..6a4ffdd8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+io:::start
+/args[0]->b_flags & B_WRITE/
+{
+ @[execname, args[2]->fi_dirname] = count();
+}
+
+END
+{
+ printf("%20s %51s %5s\n", "WHO", "WHERE", "COUNT");
+ printa("%20s %51s %5@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d
new file mode 100644
index 00000000..0a7cc6f3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d
@@ -0,0 +1,52 @@
+/*
+ * 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 D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+ printf(" %3s %10s %15s %15s %8s %6s\n", "CPU", "DELTA(us)",
+ "SOURCE", "DEST", "INT", "BYTES");
+ last = timestamp;
+}
+
+ip:::send
+{
+ this->elapsed = (timestamp - last) / 1000;
+ printf(" %3d %10d %15s -> %15s %8s %6d\n", cpu, this->elapsed,
+ args[2]->ip_saddr, args[2]->ip_daddr, args[3]->if_name,
+ args[2]->ip_plength);
+ last = timestamp;
+}
+
+ip:::receive
+{
+ this->elapsed = (timestamp - last) / 1000;
+ printf(" %3d %10d %15s <- %15s %8s %6d\n", cpu, this->elapsed,
+ args[2]->ip_daddr, args[2]->ip_saddr, args[3]->if_name,
+ args[2]->ip_plength);
+ last = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d
new file mode 100644
index 00000000..f5f3656e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d
@@ -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 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ip:::send,
+ip:::receive
+{
+ this->protostr = args[2]->ip_ver == 4 ?
+ args[4]->ipv4_protostr : args[5]->ipv6_nextstr;
+ @num[args[2]->ip_saddr, args[2]->ip_daddr, this->protostr] = count();
+}
+
+dtrace:::END
+{
+ printf(" %-28s %-28s %6s %8s\n", "SADDR", "DADDR", "PROTO", "COUNT");
+ printa(" %-28s %-28s %6s %@8d\n", @num);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d
new file mode 100755
index 00000000..a2d88e1c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d
@@ -0,0 +1,284 @@
+#!/usr/sbin/dtrace -Cqs
+/*
+ * 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 D option dynvarsize=64m
+
+#define TH_RST 0x04
+#define MAX_RECORDS 10
+#define M_CTL 0x0d
+
+#define PRINT_MAIN_HEADER() \
+ (printf("\n%-25s %-6s %-25s %-6s %-10s %-10s %8s %8s\n", \
+ "LADDR", "LPORT", "RADDR", "RPORT", "ISS", "IRS", \
+ "SND_CNT", "RCV_CNT"))
+
+#define PRINT_RECORD_HEADER() \
+ (printf("%-20s %-20s %-3s %15s %15s %8s %8s %5s\n", \
+ "PROBENAME", "TIME", "S/R", "SEQ", "ACK", "DATALEN", \
+ "WND", "FLAGS"))
+
+#define PRINT_MAIN_HEADER_VALUES() \
+ (printf("%-25s %-6d %-25s %-6d %-10d %-10d %8d %8d\n", \
+ laddr[self->conn_id], lport[self->conn_id], \
+ faddr[self->conn_id], fport[self->conn_id], \
+ iss[self->conn_id], irs[self->conn_id], \
+ send_count[self->conn_id], recv_count[self->conn_id]))
+
+#define PRINT_HEADER() \
+ PRINT_MAIN_HEADER(); PRINT_MAIN_HEADER_VALUES(); \
+ PRINT_RECORD_HEADER()
+
+#define PRINT_RECORD(i) \
+ (printf("%-20s %-20Y %-3s %15d %15d %8d %8d %2x\n", \
+ probe_name[self->conn_id, i], \
+ conn_time[self->conn_id, i], \
+ send_recv[self->conn_id, i], \
+ seqno[self->conn_id, i], \
+ ack[self->conn_id, i], \
+ datalen[self->conn_id, i], \
+ wnd[self->conn_id, i], \
+ flags[self->conn_id, i]))
+
+tcp-trace-*
+{
+ /* extract connection details */
+
+ this->mp = (mblk_t *)arg0;
+ this->mp = (this->mp->b_datap->db_type == M_CTL?
+ this->mp->b_cont : this->mp);
+ self->tcpp = (tcp_t *)arg1;
+ this->connp = (conn_t *)self->tcpp->tcp_connp;
+
+ self->iph = (ipha_t *)this->mp->b_rptr;
+ this->iph_length =
+ (int)(((ipha_t *)self->iph)->ipha_version_and_hdr_length
+ & 0xF) << 2;
+ self->tcph = (tcpha_t *)((char *)self->iph + this->iph_length);
+ this->tcph_length =
+ (((tcph_t *)self->tcph)->th_offset_and_rsrvd[0] >>2) &(0xF << 2);
+
+ /* ports */
+ self->i_lport = ntohs(this->connp->u_port.tcpu_ports.tcpu_lport);
+ self->i_fport = ntohs(this->connp->u_port.tcpu_ports.tcpu_fport);
+
+ /* IP addresses */
+ this->i_fad = (in6_addr_t *)&this->connp->connua_v6addr.connua_faddr;
+ this->i_lad = (in6_addr_t *)&this->connp->connua_v6addr.connua_laddr;
+
+ /* the address would either be IPv6 or IPv4-mapped-IPv6 */
+ self->i_faddr = inet_ntop(AF_INET6, (void *)this->i_fad);
+ self->i_laddr = inet_ntop(AF_INET6, (void *)this->i_lad);
+
+ /* create connection identifier, so we can track packets by conn */
+ self->conn_id = (uint64_t)self->tcpp->tcp_connp;
+}
+
+tcp-trace-*
+/first[self->conn_id] == 0/
+{
+ /* initialize counters - this is the first packet for this connection */
+ pcount[self->conn_id] = -1;
+ rollover[self->conn_id] = 0;
+ end_ptr[self->conn_id] = 0;
+ num[self->conn_id] = 0;
+
+ first[self->conn_id] = 1;
+
+ /* connection info */
+ laddr[self->conn_id] = self->i_laddr;
+ faddr[self->conn_id] = self->i_faddr;
+ lport[self->conn_id] = self->i_lport;
+ fport[self->conn_id] = self->i_fport;
+ iss[self->conn_id] = self->tcpp->tcp_iss;
+ irs[self->conn_id] = self->tcpp->tcp_irs;
+
+}
+
+tcp-trace-*
+{
+ /* counters, to keep track of how much info to dump */
+ pcount[self->conn_id]++;
+ rollover[self->conn_id] |= pcount[self->conn_id]/MAX_RECORDS;
+ pcount[self->conn_id] = pcount[self->conn_id]%MAX_RECORDS;
+ self->pcount = pcount[self->conn_id];
+ end_ptr[self->conn_id] = self->pcount;
+ num[self->conn_id] = (rollover[self->conn_id]?
+ MAX_RECORDS : pcount[self->conn_id] + 1);
+ conn_time[self->conn_id, self->pcount] = walltimestamp;
+
+ /* tcp state info */
+ seqno[self->conn_id, self->pcount] = ntohl(self->tcph->tha_seq);
+ ack[self->conn_id, self->pcount] = ntohl(self->tcph->tha_ack);
+ datalen[self->conn_id, self->pcount] = ntohs(self->iph->ipha_length);
+ wnd[self->conn_id, self->pcount] = ntohs(self->tcph->tha_win);
+ probe_name[self->conn_id, self->pcount] = probename;
+
+ /* flag 0x04 indicates a RST packet */
+ flags[self->conn_id, self->pcount] = self->tcph->tha_flags;
+ self->flags = self->tcph->tha_flags;
+}
+
+tcp-trace-send
+{
+ send_count[self->conn_id]++;
+ send_recv[self->conn_id, self->pcount] = "S";
+}
+
+tcp-trace-recv
+{
+ recv_count[self->conn_id]++;
+ send_recv[self->conn_id, self->pcount] = "R";
+}
+
+tcp-trace-*
+/(self->flags & TH_RST)/
+{
+ PRINT_HEADER();
+
+ self->i = (end_ptr[self->conn_id] + MAX_RECORDS - num[self->conn_id]
+ + 1)%MAX_RECORDS;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 10)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 9)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 8)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 7)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 6)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 5)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 4)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 3)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 2)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 1)/
+{
+ PRINT_RECORD(self->i);
+ self->i = (self->i + 1)%MAX_RECORDS;
+
+ num[self->conn_id]--;
+ self->reset = self->conn_id;
+}
+
+tcp-trace-*
+/self->reset/
+{
+ pcount[self->reset] = -1;
+ rollover[self->reset] = 0;
+ end_ptr[self->reset] = 0;
+ num[self->reset] = 0;
+
+ self->reset = 0;
+}
+
+conn-destroy
+{
+ /* clear old connection state */
+ this->conn_id = (uint64_t)arg0;
+
+ pcount[this->conn_id] = -1;
+ rollover[this->conn_id] = 0;
+ end_ptr[this->conn_id] = 0;
+ num[this->conn_id] = 0;
+ first[this->conn_id] = 0;
+
+ laddr[this->conn_id] = 0;
+ faddr[this->conn_id] = 0;
+ lport[this->conn_id] = 0;
+ fport[this->conn_id] = 0;
+ iss[this->conn_id] = 0;
+ irs[this->conn_id] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/whatlock.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/whatlock.d
new file mode 100644
index 00000000..7ad20c5c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/whatlock.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+lockstat:::adaptive-acquire
+/execname == "date"/
+{
+ @locks["adaptive"] = count();
+}
+
+lockstat:::spin-acquire
+/execname == "date"/
+{
+ @locks["spin"] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl
new file mode 100644
index 00000000..f2bc3ec7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl
@@ -0,0 +1,227 @@
+#!/usr/perl5/bin/perl -w
+#
+# 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.005;
+
+use strict;
+use warnings;
+use Time::localtime;
+use File::Basename;
+
+our ($cmd, $chapfile, $htmlfile, $dtrace_url, %chaps);
+
+$cmd = "mkdemo";
+$chapfile = "chapters";
+$htmlfile = "index.html";
+$dtrace_url = "http://www.sun.com/bigadmin/content/dtrace";
+
+sub chaps_read {
+ my $fatal;
+ my %hash;
+
+ open(CHAPS, "$chapfile");
+
+ while (<CHAPS>) {
+ my $field;
+ my $value;
+
+ chop;
+
+ if (/^#/) {
+ next;
+ }
+
+ if (!/:/) {
+ if (exists $hash{'name'}) {
+ if (exists $chaps{$hash{'name'}}) {
+ print "$cmd: chapter $hash{'name'} ";
+ print "has two entries.\n";
+ $fatal = 1;
+ }
+
+ $chaps{$hash{'name'}} = { %hash };
+ %hash = ();
+ next;
+ }
+
+ %hash = ();
+ next;
+ }
+
+ ($field, $value) = split /:\s*/, $_, 2;
+
+ if ($field eq "descr") {
+ $value .= " ";
+ }
+
+ $hash{$field} .= $value;
+ }
+
+ if ($fatal) {
+ print "$cmd: fatal errors; cannot proceed.\n";
+ exit;
+ }
+
+ close (CHAPS);
+}
+
+sub chaps_ascending {
+ $chaps{$a}{index} <=> $chaps{$b}{index};
+}
+
+sub demo_process {
+ my $chap = $_[0];
+ my $demo = $_[1];
+ my $year = localtime->year() + 1900;
+
+ open DEMO, "<$chap/$demo" or die "Can't open demo $chap/$demo";
+ open OUT, ">$demo" or die "Can't open $demo";
+
+ while (<DEMO>) {
+ print OUT $_;
+
+ if (/Use is subject to license terms/) {
+ print OUT <<EOF;
+ *
+ * This D script is used as an example in the Solaris Dynamic Tracing Guide
+ * wiki in the \"$chaps{$chap}{title}\" Chapter.
+ *
+ * The full text of the this chapter may be found here:
+ *
+ * $chaps{$chap}{url}
+ *
+ * On machines that have DTrace installed, this script is available as
+ * $demo in /usr/demo/dtrace, a directory that contains all D scripts
+ * used in the Solaris Dynamic Tracing Guide. A table of the scripts and their
+ * corresponding chapters may be found here:
+ *
+ * file:///usr/demo/dtrace/index.html
+EOF
+ }
+ }
+
+ close (DEMO);
+ close (OUT);
+}
+
+sub demo_find {
+ my $demo = $_[0];
+ my $chap;
+
+ foreach $chap (keys %chaps) {
+ if (!stat("$chap/$demo")) {
+ next;
+ }
+
+ demo_process($chap, $demo);
+ return;
+ }
+
+ die "Couldn't find $demo in any chapter";
+}
+
+sub chaps_process {
+ my $outfile = $_[0];
+ my $chap;
+
+ open HTML, ">$outfile" or die "Can't open $outfile.";
+
+ print HTML "<html>\n<head>\n";
+ print HTML "<title>Example DTrace Scripts</title>\n";
+ print HTML "</head>\n<body bgcolor=\"#ffffff\">\n";
+
+ print HTML "<table width=\"85%\" border=0 align=\"center\"><tr><td>";
+ print HTML "<h2>DTrace Examples</h2>\n";
+
+ print HTML "<hr><p>\n";
+ print HTML "Here are the <a href=\"$dtrace_url\">DTrace</a> scripts\n";
+ print HTML "that are used as examples in the\n";
+ print HTML "<a href=\"$chaps{book}{url}\">$chaps{book}{title}</a>. ";
+ print HTML "For more information on any one script, follow the link\n";
+ print HTML "to its corresponding chapter.\n";
+ print HTML "<p>\n<hr><p>\n";
+
+ print HTML "<left><table width=\"85%\" border=1 cellpadding=4 ";
+ print HTML "cellspacing=0 align=\"center\" bgcolor=\"#ffffff\">\n";
+ print HTML "<tr bgcolor=\"#5882a1\"><td width=\"50%\">";
+ print HTML "<font color=\"#ffffff\"><b>Chapter</b></td></font>\n";
+ print HTML "<td><font color=\"#ffffff\"><b>Script</b></td>\n";
+ print HTML "</font></tr>\n";
+
+ foreach $chap (sort chaps_ascending (keys %chaps)) {
+ my @demos;
+ my $demo;
+
+ #
+ # Open the directory associated with the chapter.
+ #
+ if ($chap =~ /^book$/) {
+ next;
+ }
+
+ opendir(DEMOS, $chap) || die("Cannot open directory $chap");
+ @demos = readdir(DEMOS);
+ closedir(DEMOS);
+
+ print HTML "<tr>\n";
+ print HTML "<td align=left>";
+ print HTML "<a href=\"$chaps{$chap}{url}\">";
+ print HTML "$chaps{$chap}{title}</a></td>\n";
+
+ print HTML "<td><table border=0>\n";
+
+ foreach $demo (sort(@demos)) {
+ if ($demo !~ /^[a-z].*\.d$/) {
+ next;
+ }
+
+ print HTML "<tr><td><a href=\"$demo\">$demo</a>";
+ print HTML "</td></tr>\n";
+
+ demo_process($chap, $demo);
+ }
+
+ print HTML "</table></td></tr>\n";
+ }
+
+ print HTML "</table>\n</td>\n<p>\n\n";
+ print HTML "</td></tr>\n";
+ print HTML "<tr><td><hr><small>Copyright ";
+ print HTML localtime->year() + 1900;
+ print HTML " Sun Microsystems</small>\n";
+ print HTML "</table>\n";
+ print HTML "</body>\n</html>\n";
+ close HTML;
+}
+
+chaps_read();
+
+if (basename($ARGV[0]) ne "$htmlfile") {
+ demo_find(basename($ARGV[0]));
+} else {
+ chaps_process($htmlfile);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d
new file mode 100644
index 00000000..f3cee56c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+profile:::profile-997
+{
+ @a[caller] = count();
+}
+
+END
+{
+ printa("%@8u %a\n", @a);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d
new file mode 100644
index 00000000..53949af4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+proc:::lwp-start
+/tid != 1/
+{
+ self->start = timestamp;
+}
+
+proc:::lwp-exit
+/self->start/
+{
+ @[execname] = quantize(timestamp - self->start);
+ self->start = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/progtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/progtime.d
new file mode 100644
index 00000000..8bfa369f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/progtime.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+proc:::start
+{
+ self->start = timestamp;
+}
+
+proc:::exit
+/self->start/
+{
+ @[execname] = quantize(timestamp - self->start);
+ self->start = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d
new file mode 100644
index 00000000..07d9b25c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+proc:::signal-send
+{
+ @[execname, stringof(args[1]->pr_fname), args[2]] = count();
+}
+
+END
+{
+ printf("%20s %20s %12s %s\n",
+ "SENDER", "RECIPIENT", "SIG", "COUNT");
+ printa("%20s %20s %12d %@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d
new file mode 100644
index 00000000..ee0fe4ff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+proc:::exec
+{
+ self->parent = execname;
+}
+
+proc:::exec-success
+/self->parent != NULL/
+{
+ @[self->parent, execname] = count();
+ self->parent = NULL;
+}
+
+proc:::exec-failure
+/self->parent != NULL/
+{
+ self->parent = NULL;
+}
+
+END
+{
+ printf("%-20s %-20s %s\n", "WHO", "WHAT", "COUNT");
+ printa("%-20s %-20s %@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d
new file mode 100644
index 00000000..4eedf502
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+profile-97
+/pid != 0/
+{
+ @proc[pid, execname] = count();
+}
+
+END
+{
+ printf("%-8s %-40s %s\n", "PID", "CMD", "COUNT");
+ printa("%-8d %-40s %@d\n", @proc);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/profpri.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/profpri.d
new file mode 100644
index 00000000..615594b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/profpri.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+profile-1001
+/pid == $1/
+{
+ @proc[execname] = lquantize(curlwpsinfo->pr_pri, 0, 100, 10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/restest.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/restest.d
new file mode 100644
index 00000000..390ea124
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/restest.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+profile-5000
+{
+ /*
+ * We divide by 1,000,000 to convert nanoseconds to milliseconds, and
+ * then we take the value mod 10 to get the current millisecond within
+ * a 10 millisecond window. On platforms that do not support truly
+ * arbitrary resolution profile probes, all of the profile-5000 probes
+ * will fire on roughly the same millisecond. On platforms that
+ * support a truly arbitrary resolution, the probe firings will be
+ * evenly distributed across the milliseconds.
+ */
+ @ms = lquantize((timestamp / 1000000) % 10, 0, 10, 1);
+}
+
+tick-1sec
+/i++ >= 10/
+{
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/firebird.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/firebird.d
new file mode 100644
index 00000000..ab65e956
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/firebird.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::sleep
+/execname == "MozillaFirebird" && curlwpsinfo->pr_stype == SOBJ_CV/
+{
+ bedtime[curlwpsinfo->pr_addr] = timestamp;
+}
+
+sched:::wakeup
+/execname == "MozillaFirebird" && bedtime[args[0]->pr_addr]/
+{
+ @[args[1]->pr_pid, args[0]->pr_lwpid, pid, curlwpsinfo->pr_lwpid] =
+ quantize(timestamp - bedtime[args[0]->pr_addr]);
+ bedtime[args[0]->pr_addr] = 0;
+}
+
+sched:::wakeup
+/bedtime[args[0]->pr_addr]/
+{
+ bedtime[args[0]->pr_addr] = 0;
+}
+
+END
+{
+ printa("%d/%d sleeping on %d/%d:\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/howlong.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/howlong.d
new file mode 100644
index 00000000..0fcfa1c1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/howlong.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::off-cpu
+/curlwpsinfo->pr_state == SSLEEP/
+{
+ self->cpu = cpu;
+ self->ts = timestamp;
+}
+
+sched:::on-cpu
+/self->ts/
+{
+ @[self->cpu == cpu ?
+ "sleep time, no CPU migration" : "sleep time, CPU migration"] =
+ lquantize((timestamp - self->ts) / 1000000, 0, 500, 25);
+ self->ts = 0;
+ self->cpu = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d
new file mode 100644
index 00000000..8e30ac44
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::sleep
+/curlwpsinfo->pr_stype == SOBJ_SHUTTLE/
+{
+ bedtime[curlwpsinfo->pr_addr] = timestamp;
+}
+
+sched:::wakeup
+/execname == "nscd" && bedtime[args[0]->pr_addr]/
+{
+ @[stringof(curpsinfo->pr_fname), stringof(args[1]->pr_fname)] =
+ quantize(timestamp - bedtime[args[0]->pr_addr]);
+ bedtime[args[0]->pr_addr] = 0;
+}
+
+sched:::wakeup
+/bedtime[args[0]->pr_addr]/
+{
+ bedtime[args[0]->pr_addr] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d
new file mode 100644
index 00000000..ea76fd79
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::change-pri
+{
+ @[stringof(args[0]->pr_clname)] =
+ lquantize(args[2] - args[0]->pr_pri, -50, 50, 5);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pritime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pritime.d
new file mode 100644
index 00000000..2c80e6a7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pritime.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ start = timestamp;
+}
+
+sched:::change-pri
+/args[1]->pr_pid == $1 && args[0]->pr_lwpid == $2/
+{
+ printf("%d %d\n", timestamp - start, args[2]);
+}
+
+tick-1sec
+/++n == 5/
+{
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d
new file mode 100644
index 00000000..a34ae4cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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.
+ */
+
+sched:::enqueue
+{
+ this->len = qlen[args[2]->cpu_id]++;
+ @[args[2]->cpu_id] = lquantize(this->len, 0, 100);
+}
+
+sched:::dequeue
+/qlen[args[2]->cpu_id]/
+{
+ qlen[args[2]->cpu_id]--;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d
new file mode 100644
index 00000000..54ebf5f5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d
@@ -0,0 +1,38 @@
+/*
+ * 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 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::enqueue
+{
+ ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id] =
+ timestamp;
+}
+
+sched:::dequeue
+/ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id]/
+{
+ @[args[2]->cpu_id] = quantize(timestamp -
+ ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id]);
+ ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d
new file mode 100644
index 00000000..88427593
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::tick,
+sched:::enqueue
+{
+ @[probename] = lquantize((timestamp / 1000000) % 10, 0, 10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/ticktime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/ticktime.d
new file mode 100644
index 00000000..e24a80ad
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/ticktime.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+uint64_t last[int];
+
+sched:::tick
+/last[cpu]/
+{
+ @[cpu] = min(timestamp - last[cpu]);
+}
+
+sched:::tick
+{
+ last[cpu] = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whatfor.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whatfor.d
new file mode 100644
index 00000000..d8b6edb0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whatfor.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::off-cpu
+/curlwpsinfo->pr_state == SSLEEP/
+{
+ /*
+ * We're sleeping. Track our sobj type.
+ */
+ self->sobj = curlwpsinfo->pr_stype;
+ self->bedtime = timestamp;
+}
+
+sched:::off-cpu
+/curlwpsinfo->pr_state == SRUN/
+{
+ self->bedtime = timestamp;
+}
+
+sched:::on-cpu
+/self->bedtime && !self->sobj/
+{
+ @["preempted"] = quantize(timestamp - self->bedtime);
+ self->bedtime = 0;
+}
+
+sched:::on-cpu
+/self->sobj/
+{
+ @[self->sobj == SOBJ_MUTEX ? "kernel-level lock" :
+ self->sobj == SOBJ_RWLOCK ? "rwlock" :
+ self->sobj == SOBJ_CV ? "condition variable" :
+ self->sobj == SOBJ_SEMA ? "semaphore" :
+ self->sobj == SOBJ_USER ? "user-level lock" :
+ self->sobj == SOBJ_USER_PI ? "user-level prio-inheriting lock" :
+ self->sobj == SOBJ_SHUTTLE ? "shuttle" : "unknown"] =
+ quantize(timestamp - self->bedtime);
+
+ self->sobj = 0;
+ self->bedtime = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d
new file mode 100644
index 00000000..af026244
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::on-cpu
+{
+ self->ts = timestamp;
+}
+
+sched:::off-cpu
+/self->ts/
+{
+ @[cpu] = quantize(timestamp - self->ts);
+ self->ts = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whererun.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whererun.d
new file mode 100644
index 00000000..ddd13f75
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whererun.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ start = timestamp;
+}
+
+sched:::on-cpu
+/execname == $$1/
+{
+ self->ts = timestamp;
+}
+
+sched:::off-cpu
+/self->ts/
+{
+ @[cpu] = sum(timestamp - self->ts);
+ self->ts = 0;
+}
+
+profile:::tick-1sec
+/++x == 10/
+{
+ exit(0);
+}
+
+dtrace:::END
+{
+ printf("CPU distribution over %d seconds:\n\n",
+ (timestamp - start) / 1000000000);
+ printf("CPU microseconds\n--- ------------\n");
+ normalize(@, 1000);
+ printa("%3d %@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d
new file mode 100644
index 00000000..f0243d60
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::sleep
+/!(curlwpsinfo->pr_flag & PR_ISSYS) && curlwpsinfo->pr_stype == SOBJ_CV/
+{
+ bedtime[curlwpsinfo->pr_addr] = timestamp;
+}
+
+sched:::wakeup
+/bedtime[args[0]->pr_addr]/
+{
+ @[stringof(args[1]->pr_fname), execname] =
+ quantize(timestamp - bedtime[args[0]->pr_addr]);
+ bedtime[args[0]->pr_addr] = 0;
+}
+
+END
+{
+ printa("%s sleeping on %s:\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whopreempt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whopreempt.d
new file mode 100644
index 00000000..e8dd8633
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whopreempt.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::preempt
+{
+ self->preempt = 1;
+}
+
+sched:::remain-cpu
+/self->preempt/
+{
+ self->preempt = 0;
+}
+
+sched:::off-cpu
+/self->preempt/
+{
+ /*
+ * If we were told to preempt ourselves, see who we ended up giving
+ * the CPU to.
+ */
+ @[stringof(args[1]->pr_fname), args[0]->pr_pri, execname,
+ curlwpsinfo->pr_pri] = count();
+ self->preempt = 0;
+}
+
+END
+{
+ printf("%30s %3s %30s %3s %5s\n", "PREEMPTOR", "PRI",
+ "PREEMPTED", "PRI", "#");
+ printa("%30s %3d %30s %3d %5@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whoqueue.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whoqueue.d
new file mode 100644
index 00000000..c2ab47a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whoqueue.d
@@ -0,0 +1,95 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+#pragma D option nspec=4
+#pragma D option specsize=100k
+
+int maxlen;
+int spec[int];
+
+sched:::enqueue
+{
+ this->len = ++qlen[this->cpu = args[2]->cpu_id];
+ in[args[0]->pr_addr] = timestamp;
+}
+
+sched:::enqueue
+/this->len > maxlen && spec[this->cpu]/
+{
+ /*
+ * There is already a speculation for this CPU. We just set a new
+ * record, so we'll discard the old one.
+ */
+ discard(spec[this->cpu]);
+}
+
+sched:::enqueue
+/this->len > maxlen/
+{
+ /*
+ * We have a winner. Set the new maximum length and set the timestamp
+ * of the longest length.
+ */
+ maxlen = this->len;
+ longtime[this->cpu] = timestamp;
+
+ /*
+ * Now start a new speculation, and speculatively trace the length.
+ */
+ this->spec = spec[this->cpu] = speculation();
+ speculate(this->spec);
+ printf("Run queue of length %d:\n", this->len);
+}
+
+sched:::dequeue
+/(this->in = in[args[0]->pr_addr]) &&
+ this->in <= longtime[this->cpu = args[2]->cpu_id]/
+{
+ speculate(spec[this->cpu]);
+ printf(" %d/%d (%s)\n",
+ args[1]->pr_pid, args[0]->pr_lwpid,
+ stringof(args[1]->pr_fname));
+}
+
+sched:::dequeue
+/qlen[args[2]->cpu_id]/
+{
+ in[args[0]->pr_addr] = 0;
+ this->len = --qlen[args[2]->cpu_id];
+}
+
+sched:::dequeue
+/this->len == 0 && spec[this->cpu]/
+{
+ /*
+ * We just processed the last thread that was enqueued at the time
+ * of longest length; commit the speculation, which by now contains
+ * each thread that was enqueued when the queue was longest.
+ */
+ commit(spec[this->cpu]);
+ spec[this->cpu] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whosteal.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whosteal.d
new file mode 100644
index 00000000..c698e4f1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whosteal.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::dequeue
+/args[2]->cpu_id != -1 && cpu != args[2]->cpu_id &&
+ (curlwpsinfo->pr_flag & PR_IDLE)/
+{
+ @[stringof(args[1]->pr_fname), args[2]->cpu_id] =
+ lquantize(cpu, 0, 100);
+}
+
+END
+{
+ printa("%s stolen from CPU %d by:\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d
new file mode 100644
index 00000000..bb5ed33c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ start = timestamp;
+}
+
+sched:::wakeup
+/stringof(args[1]->pr_fname) == "xterm"/
+{
+ @[execname] = lquantize((timestamp - start) / 1000000000, 0, 10);
+}
+
+profile:::tick-1sec
+/++x == 10/
+{
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d
new file mode 100644
index 00000000..cbaf1057
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+self int last;
+
+sched:::wakeup
+/self->last && args[0]->pr_stype == SOBJ_CV/
+{
+ @[stringof(args[1]->pr_fname)] = sum(vtimestamp - self->last);
+ self->last = 0;
+}
+
+sched:::wakeup
+/execname == "Xsun" && self->last == 0/
+{
+ self->last = vtimestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/interp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/interp.d
new file mode 100644
index 00000000..c3e419ec
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/interp.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#!/usr/sbin/dtrace -s
+
+BEGIN
+{
+ trace("hello");
+ exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/syscall.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/syscall.d
new file mode 100644
index 00000000..c47fb922
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/syscall.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall:::entry
+/pid == $target/
+{
+ @[probefunc] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/tracewrite.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/tracewrite.d
new file mode 100644
index 00000000..c1336cf7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/tracewrite.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#!/usr/sbin/dtrace -s
+
+syscall::write:entry
+/pid == $1/
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d
new file mode 100644
index 00000000..2044536f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sdt:::callout-start
+{
+ @callouts[((callout_t *)arg0)->c_func] = count();
+}
+
+tick-1sec
+{
+ printa("%40a %10@d\n", @callouts);
+ clear(@callouts);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d
new file mode 100644
index 00000000..d4a6a320
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sdt:::callout-start
+{
+ self->callout = ((callout_t *)arg0)->c_func;
+}
+
+fbt::timeout:entry
+/self->callout && arg2 <= 100/
+{
+ /*
+ * In this case, we are most interested in interval timeout(9F)s that
+ * are short. We therefore do a linear quantization from 0 ticks to
+ * 100 ticks. The system clock's frequency ? set by the variable
+ * "hz" ? defaults to 100, so 100 system clock ticks is one second.
+ */
+ @callout[self->callout] = lquantize(arg2, 0, 100);
+}
+
+sdt:::callout-end
+{
+ self->callout = NULL;
+}
+
+END
+{
+ printa("%a\n%@d\n\n", @callout);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d
new file mode 100644
index 00000000..5233450f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+interrupt-start
+{
+ self->ts = vtimestamp;
+}
+
+interrupt-complete
+/self->ts/
+{
+ this->devi = (struct dev_info *)arg0;
+ @[stringof(`devnamesp[this->devi->devi_major].dn_name),
+ this->devi->devi_instance] = quantize(vtimestamp - self->ts);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d
new file mode 100644
index 00000000..dc162a1b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::open:entry
+{
+ self->spec = speculation();
+}
+
+syscall:::
+/self->spec/
+{
+ speculate(self->spec);
+ printf("this is speculative");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/specopen.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/specopen.d
new file mode 100644
index 00000000..f1975ff8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/specopen.d
@@ -0,0 +1,93 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#!/usr/sbin/dtrace -Fs
+
+syscall::open:entry,
+syscall::open64:entry
+{
+ /*
+ * The call to speculation() creates a new speculation. If this fails,
+ * dtrace(1M) will generate an error message indicating the reason for
+ * the failed speculation(), but subsequent speculative tracing will be
+ * silently discarded.
+ */
+ self->spec = speculation();
+ speculate(self->spec);
+
+ /*
+ * Because this printf() follows the speculate(), it is being
+ * speculatively traced; it will only appear in the data buffer if the
+ * speculation is subsequently commited.
+ */
+ printf("%s", stringof(copyinstr(arg0)));
+}
+
+fbt:::
+/self->spec/
+{
+ /*
+ * A speculate() with no other actions speculates the default action:
+ * tracing the EPID.
+ */
+ speculate(self->spec);
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec/
+{
+ /*
+ * To balance the output with the -F option, we want to be sure that
+ * every entry has a matching return. Because we speculated the
+ * open entry above, we want to also speculate the open return.
+ * This is also a convenient time to trace the errno value.
+ */
+ speculate(self->spec);
+ trace(errno);
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec && errno != 0/
+{
+ /*
+ * If errno is non-zero, we want to commit the speculation.
+ */
+ commit(self->spec);
+ self->spec = 0;
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec && errno == 0/
+{
+ /*
+ * If errno is not set, we discard the speculation.
+ */
+ discard(self->spec);
+ self->spec = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d
new file mode 100644
index 00000000..1b40ddaa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$1:libkstat:kstat_data_lookup:entry
+{
+ self->ksname = arg1;
+}
+
+pid$1:libkstat:kstat_data_lookup:return
+/self->ksname != NULL && arg1 != NULL/
+{
+ this->ksp = (kstat_named_t *) copyin(arg1, sizeof (kstat_named_t));
+ printf("%s has ui64 value %u\n",
+ copyinstr(self->ksname), this->ksp->value.ui64);
+}
+
+pid$1:libkstat:kstat_data_lookup:return
+/self->ksname != NULL && arg1 == NULL/
+{
+ self->ksname = NULL;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d
new file mode 100644
index 00000000..ab2f1cb5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * When our strings(1) invocation starts a read(2), set a watched flag on
+ * the current thread. When the read(2) finishes, clear the watched flag.
+ */
+syscall::read:entry
+/curpsinfo->pr_psargs == "strings -a /dev/ksyms"/
+{
+ printf("read %u bytes to user address %x\n", arg2, arg1);
+ self->watched = 1;
+}
+
+syscall::read:return
+/self->watched/
+{
+ self->watched = 0;
+}
+
+/*
+ * Instrument uiomove(9F). The prototype for this function is as follows:
+ * int uiomove(caddr_t addr, size_t nbytes, enum uio_rw rwflag, uio_t *uio);
+ */
+fbt::uiomove:entry
+/self->watched/
+{
+ this->iov = args[3]->uio_iov;
+
+ printf("uiomove %u bytes to %p in pid %d\n",
+ this->iov->iov_len, this->iov->iov_base, pid);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/rwinfo.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/rwinfo.d
new file mode 100644
index 00000000..866678ef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/rwinfo.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+struct callinfo {
+ uint64_t ts; /* timestamp of last syscall entry */
+ uint64_t elapsed; /* total elapsed time in nanoseconds */
+ uint64_t calls; /* number of calls made */
+ size_t maxbytes; /* maximum byte count argument */
+};
+
+struct callinfo i[string]; /* declare i as an associative array */
+
+syscall::read:entry, syscall::write:entry
+/pid == $1/
+{
+ i[probefunc].ts = timestamp;
+ i[probefunc].calls++;
+ i[probefunc].maxbytes = arg2 > i[probefunc].maxbytes ?
+ arg2 : i[probefunc].maxbytes;
+}
+
+syscall::read:return, syscall::write:return
+/i[probefunc].ts != 0 && pid == $1/
+{
+ i[probefunc].elapsed += timestamp - i[probefunc].ts;
+}
+
+END
+{
+ printf(" calls max bytes elapsed nsecs\n");
+ printf("------ ----- --------- -------------\n");
+ printf(" read %5d %9d %d\n",
+ i["read"].calls, i["read"].maxbytes, i["read"].elapsed);
+ printf(" write %5d %9d %d\n",
+ i["write"].calls, i["write"].maxbytes, i["write"].elapsed);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d
new file mode 100644
index 00000000..d927072c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall:::entry
+/execname == "find"/
+{
+ self->syscall = probefunc;
+ self->insys = 1;
+}
+
+sysinfo:::xcalls
+/execname == "find"/
+{
+ @[self->insys ? self->syscall : "<none>"] = count();
+}
+
+syscall:::return
+/self->insys/
+{
+ self->insys = 0;
+ self->syscall = NULL;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d
new file mode 100755
index 00000000..94001296
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d
@@ -0,0 +1,37 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::connect-established
+{
+ start[args[1]->cs_cid] = timestamp;
+}
+
+tcp:::receive
+/start[args[1]->cs_cid] && (args[2]->ip_plength - args[4]->tcp_offset) > 0/
+{
+ @latency["1st Byte Latency (ns)", args[2]->ip_saddr] =
+ quantize(timestamp - start[args[1]->cs_cid]);
+ start[args[1]->cs_cid] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d
new file mode 100755
index 00000000..7fb68de9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d
@@ -0,0 +1,36 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::receive
+{
+ @bytes[args[2]->ip_saddr, args[4]->tcp_dport] =
+ sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+tcp:::send
+{
+ @bytes[args[2]->ip_daddr, args[4]->tcp_sport] =
+ sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d
new file mode 100755
index 00000000..ecd9b044
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d
@@ -0,0 +1,45 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+
+tcp:::receive
+{
+ @bytes[args[2]->ip_saddr, args[4]->tcp_dport] =
+ sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+tcp:::send
+{
+ @bytes[args[2]->ip_daddr, args[4]->tcp_sport] =
+ sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+profile:::tick-1sec
+{
+ printf("\n %-32s %16s\n", "HOST", "BYTES/s");
+ printa(" %-32s %@16d\n", @bytes);
+ trunc(@bytes);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpconnlat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpconnlat.d
new file mode 100755
index 00000000..bc395f97
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpconnlat.d
@@ -0,0 +1,37 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::connect-request
+{
+ start[args[1]->cs_cid] = timestamp;
+}
+
+tcp:::connect-established
+/start[args[1]->cs_cid] /
+{
+ @latency["Connect Latency (ns)", args[3]->tcps_raddr] =
+ quantize(timestamp - start[args[1]->cs_cid]);
+ start[args[1]->cs_cid] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d
new file mode 100755
index 00000000..b3628430
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d
@@ -0,0 +1,32 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::send,
+tcp:::receive
+{
+ printf("%15s:%-5d -> %15s:%-5d",
+ args[2]->ip_saddr, args[4]->tcp_sport,
+ args[2]->ip_daddr, args[4]->tcp_dport);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpioflags.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpioflags.d
new file mode 100755
index 00000000..cdfbd2aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpioflags.d
@@ -0,0 +1,64 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+ printf(" %15s:%-5s %15s:%-5s %6s %s\n",
+ "LADDR", "PORT", "RADDR", "PORT", "BYTES", "FLAGS");
+}
+
+tcp:::send
+{
+ this->length = args[2]->ip_plength - args[4]->tcp_offset;
+ printf(" %15s:%-5d -> %15s:%-5d %6d (",
+ args[2]->ip_saddr, args[4]->tcp_sport,
+ args[2]->ip_daddr, args[4]->tcp_dport, this->length);
+}
+
+tcp:::receive
+{
+ this->length = args[2]->ip_plength - args[4]->tcp_offset;
+ printf(" %15s:%-5d <- %15s:%-5d %6d (",
+ args[2]->ip_daddr, args[4]->tcp_dport,
+ args[2]->ip_saddr, args[4]->tcp_sport, this->length);
+}
+
+tcp:::send,
+tcp:::receive
+{
+ printf("%s", args[4]->tcp_flags & TH_FIN ? "FIN|" : "");
+ printf("%s", args[4]->tcp_flags & TH_SYN ? "SYN|" : "");
+ printf("%s", args[4]->tcp_flags & TH_RST ? "RST|" : "");
+ printf("%s", args[4]->tcp_flags & TH_PUSH ? "PUSH|" : "");
+ printf("%s", args[4]->tcp_flags & TH_ACK ? "ACK|" : "");
+ printf("%s", args[4]->tcp_flags & TH_URG ? "URG|" : "");
+ printf("%s", args[4]->tcp_flags & TH_ECE ? "ECE|" : "");
+ printf("%s", args[4]->tcp_flags & TH_CWR ? "CWR|" : "");
+ printf("%s", args[4]->tcp_flags == 0 ? "null " : "");
+ printf("\b)\n");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d
new file mode 100755
index 00000000..9d44519e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d
@@ -0,0 +1,78 @@
+#!/usr/sbin/dtrace -s
+/*
+ * tcpsnoop - snoop TCP network packets by process.
+ * Written using DTrace tcp Provider.
+ *
+ * This analyses TCP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * from existing and newly created TCP connections. It can help identify
+ * which processes are causing TCP traffic.
+ *
+ * SEE ALSO: snoop -rS
+ *
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+ printf("%6s %6s %15s:%-5s %15s:%-5s %6s %s\n",
+ "TIME", "PID", "LADDR", "PORT", "RADDR", "PORT", "BYTES", "FLAGS");
+}
+
+tcp:::send
+{
+ this->length = args[2]->ip_plength - args[4]->tcp_offset;
+ printf("%6d %6d %15s:%-5d -> %15s:%-5d %6d (",
+ timestamp/1000, args[1]->cs_pid, args[2]->ip_saddr,
+ args[4]->tcp_sport, args[2]->ip_daddr, args[4]->tcp_dport,
+ this->length);
+}
+
+tcp:::receive
+{
+ this->length = args[2]->ip_plength - args[4]->tcp_offset;
+ printf("%6d %6d %15s:%-5d <- %15s:%-5d %6d (",
+ timestamp/1000, args[1]->cs_pid, args[2]->ip_daddr,
+ args[4]->tcp_dport, args[2]->ip_saddr, args[4]->tcp_sport,
+ this->length);
+}
+
+tcp:::send,
+tcp:::receive
+{
+ printf("%s", args[4]->tcp_flags & TH_FIN ? "FIN|" : "");
+ printf("%s", args[4]->tcp_flags & TH_SYN ? "SYN|" : "");
+ printf("%s", args[4]->tcp_flags & TH_RST ? "RST|" : "");
+ printf("%s", args[4]->tcp_flags & TH_PUSH ? "PUSH|" : "");
+ printf("%s", args[4]->tcp_flags & TH_ACK ? "ACK|" : "");
+ printf("%s", args[4]->tcp_flags & TH_URG ? "URG|" : "");
+ printf("%s", args[4]->tcp_flags & TH_ECE ? "ECE|" : "");
+ printf("%s", args[4]->tcp_flags & TH_CWR ? "CWR|" : "");
+ printf("%s", args[4]->tcp_flags == 0 ? "null " : "");
+ printf("\b)\n");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d
new file mode 100755
index 00000000..38f0470a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d
@@ -0,0 +1,39 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("%-10s %-10s %-20s %-20s\n", "C", "PID", "PREV", "NEW");
+}
+
+
+tcp:::state-change
+{
+ printf("%-10d %-10d %-20s -> %-20s\n", cpu, args[1]->cs_pid,
+ tcp_state_string[args[5]->tcps_state],
+ tcp_state_string[args[3]->tcps_state]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d
new file mode 100755
index 00000000..450f496e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d
@@ -0,0 +1,138 @@
+#!/usr/sbin/dtrace -s
+/*
+ * tcptop: display top TCP network packets by process.
+ * Written using DTrace tcp Provider.
+ *
+ * Usage: dtrace -s tcptop.d [count] [interval]
+ *
+ * This analyses TCP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * of newly created TCP connections that were established while this program
+ * was running along with traffic from existing connections. It can help
+ * identify which processes is causing TCP traffic.
+ *
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+#pragma D option switchrate=10hz
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* starting values */
+ counts = $1 ? $1 : 10;
+ secs = $2 ? $2 : 5;
+ TCP_out = 0;
+ TCP_in = 0;
+
+ printf("Sampling... Please wait.\n");
+}
+
+
+tcp:::send
+/ args[1]->cs_pid != -1 /
+{
+ @out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_saddr,
+ args[4]->tcp_sport, args[2]->ip_daddr, args[4]->tcp_dport] =
+ sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+tcp:::receive
+/ args[1]->cs_pid != -1 /
+{
+ @out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_daddr,
+ args[4]->tcp_dport, args[2]->ip_saddr, args[4]->tcp_sport] =
+ sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+/*
+ * TCP Systemwide Stats
+ */
+mib:::tcpOutDataBytes { TCP_out += args[0]; }
+mib:::tcpRetransBytes { TCP_out += args[0]; }
+mib:::tcpInDataInorderBytes { TCP_in += args[0]; }
+mib:::tcpInDataDupBytes { TCP_in += args[0]; }
+mib:::tcpInDataUnorderBytes { TCP_in += args[0]; }
+
+profile:::tick-1sec
+/secs != 0/
+{
+ secs--;
+}
+
+/*
+ * Print Report
+ */
+profile:::tick-1sec
+/secs == 0/
+{
+ /* fetch 1 min load average */
+ this->load1a = `hp_avenrun[0] / 65536;
+ this->load1b = ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+ /* convert TCP counters to Kb */
+ TCP_out /= 1024;
+ TCP_in /= 1024;
+
+ /* print status */
+ printf("%Y, load: %d.%02d, TCPin: %6d Kb, TCPout: %6d Kb\n\n",
+ walltimestamp, this->load1a, this->load1b, TCP_in, TCP_out);
+
+ /* print headers */
+ printf("%6s %6s %-15s %5s %-15s %5s %9s\n",
+ "ZONE", "PID", "LADDR", "LPORT", "RADDR", "RPORT", "SIZE");
+
+ /* print data */
+ printa("%6d %6d %-15s %5d %-15s %5d %@9d\n", @out);
+ printf("\n");
+
+ /* clear data */
+ trunc(@out);
+ TCP_in = 0;
+ TCP_out = 0;
+ secs = 5;
+ counts--;
+}
+
+/*
+ * End of program
+ */
+profile:::tick-1sec
+/counts == 0/
+{
+ exit(0);
+}
+
+/*
+ * Cleanup for Ctrl-C
+ */
+dtrace:::END
+{
+ trunc(@out);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d
new file mode 100755
index 00000000..29d85fcd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d
@@ -0,0 +1,36 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+udp:::receive
+{
+ @bytes[args[2]->ip_saddr, args[4]->udp_dport] =
+ sum(args[4]->udp_length);
+}
+
+udp:::send
+{
+ @bytes[args[2]->ip_daddr, args[4]->udp_sport] =
+ sum(args[4]->udp_length);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytesstat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytesstat.d
new file mode 100755
index 00000000..58fa826a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytesstat.d
@@ -0,0 +1,45 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+
+udp:::receive
+{
+ @bytes[args[2]->ip_saddr, args[4]->udp_dport] =
+ sum(args[4]->udp_length);
+}
+
+udp:::send
+{
+ @bytes[args[2]->ip_daddr, args[4]->udp_sport] =
+ sum(args[4]->udp_length);
+}
+
+profile:::tick-1sec
+{
+ printf("\n %-32s %16s\n", "HOST", "BYTES/s");
+ printa(" %-32s %@16d\n", @bytes);
+ trunc(@bytes);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d
new file mode 100755
index 00000000..78b3f482
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d
@@ -0,0 +1,32 @@
+#!/usr/sbin/dtrace -s
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+udp:::send,
+udp:::receive
+{
+ printf("%15s:%-5d -> %15s:%-5d",
+ args[2]->ip_saddr, args[4]->udp_sport,
+ args[2]->ip_daddr, args[4]->udp_dport);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d
new file mode 100755
index 00000000..fffc2904
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d
@@ -0,0 +1,59 @@
+#!/usr/sbin/dtrace -s
+/*
+ * udpsnoop - snoop UDP network packets by process.
+ * Written using DTrace udp Provider.
+ *
+ * This analyses UDP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * from existing and newly created UDP connections. It can help identify
+ * which processes are causing UDP traffic.
+ *
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+ printf("%6s %6s %15s:%-5s %15s:%-5s %6s\n",
+ "TIME", "PID", "LADDR", "PORT", "RADDR", "PORT", "BYTES");
+}
+
+udp:::send
+{
+ printf("%6d %6d %15s:%-5d -> %15s:%-5d %6d\n",
+ timestamp/1000, args[1]->cs_pid, args[2]->ip_saddr,
+ args[4]->udp_sport, args[2]->ip_daddr, args[4]->udp_dport,
+ args[4]->udp_length);
+}
+
+udp:::receive
+{
+ printf("%6d %6d %15s:%-5d <- %15s:%-5d %6d\n",
+ timestamp/1000, args[1]->cs_pid, args[2]->ip_daddr,
+ args[4]->udp_dport, args[2]->ip_saddr, args[4]->udp_sport,
+ args[4]->udp_length);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d
new file mode 100755
index 00000000..a626e571
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d
@@ -0,0 +1,133 @@
+#!/usr/sbin/dtrace -s
+/*
+ * udptop: display top UDP network packets by process.
+ * Written using DTrace udp Provider.
+ *
+ * Usage: dtrace -s udptop.d [count] [interval]
+ *
+ * This analyses UDP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * of newly created UDP connections that were established while this program
+ * was running along with traffic from existing connections. It can help
+ * identify which processes is causing UDP traffic.
+ *
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+#pragma D option switchrate=10hz
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+ /* starting values */
+ counts = $1 ? $1 : 10;
+ secs = $2 ? $2 : 5;
+ UDP_out = 0;
+ UDP_in = 0;
+
+ printf("Sampling... Please wait.\n");
+}
+
+
+udp:::send
+/ args[1]->cs_pid != -1 /
+{
+ @out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_saddr,
+ args[4]->udp_sport, args[2]->ip_daddr, args[4]->udp_dport] =
+ sum(args[4]->udp_length);
+}
+
+udp:::receive
+/ args[1]->cs_pid != -1 /
+{
+ @out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_daddr,
+ args[4]->udp_dport, args[2]->ip_saddr, args[4]->udp_sport] =
+ sum(args[4]->udp_length);
+}
+
+/*
+ * UDP Systemwide Stats
+ */
+mib:::udpHCOutDatagrams { UDP_out += args[0]; }
+mib:::udpHCInDatagrams { UDP_in += args[0]; }
+
+profile:::tick-1sec
+/secs != 0/
+{
+ secs--;
+}
+
+/*
+ * Print Report
+ */
+profile:::tick-1sec
+/secs == 0/
+{
+ /* fetch 1 min load average */
+ this->load1a = `hp_avenrun[0] / 65536;
+ this->load1b = ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+ /* print status */
+ printf(%Y, load: %d.%02d, UDP datagrams in: %6d, ",
+ walltimestamp, this->load1a, this->load1b, UDP_in);
+ printf("UDP datagrams out: %6d\n\n", UDP_out);
+
+ /* print headers */
+ printf("%6s %6s %-15s %5s %-15s %5s %9s\n",
+ "ZONE", "PID", "LADDR", "LPORT", "RADDR", "RPORT", "SIZE");
+
+ /* print data */
+ printa("%6d %6d %-15s %5d %-15s %5d %@9d\n", @out);
+ printf("\n");
+
+ /* clear data */
+ trunc(@out);
+ UDP_in = 0;
+ UDP_out = 0;
+ secs = 5;
+ counts--;
+}
+
+/*
+ * End of program
+ */
+profile:::tick-1sec
+/counts == 0/
+{
+ exit(0);
+}
+
+/*
+ * Cleanup for Ctrl-C
+ */
+dtrace:::END
+{
+ trunc(@out);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d
new file mode 100644
index 00000000..7e6d22b7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::open:entry
+/pid == $1/
+{
+ self->path = copyinstr(arg0);
+}
+
+syscall::open:return
+/self->path != NULL && arg1 == -1/
+{
+ printf("open for '%s' failed", self->path);
+ ustack();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/errorpath.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/errorpath.d
new file mode 100644
index 00000000..95c82e51
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/errorpath.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$1::$2:entry
+{
+ self->spec = speculation();
+ speculate(self->spec);
+ printf("%x %x %x %x %x", arg0, arg1, arg2, arg3, arg4);
+}
+
+pid$1::$2:
+/self->spec/
+{
+ speculate(self->spec);
+}
+
+pid$1::$2:return
+/self->spec && arg1 == 0/
+{
+ discard(self->spec);
+ self->spec = 0;
+}
+
+pid$1::$2:return
+/self->spec && arg1 != 0/
+{
+ commit(self->spec);
+ self->spec = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d
new file mode 100644
index 00000000..92b20cfe
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$target:libc.so::entry
+{
+ @[probefunc] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/userfunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/userfunc.d
new file mode 100644
index 00000000..0c98d675
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/userfunc.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$1::$2:entry
+{
+ self->trace = 1;
+}
+
+pid$1::$2:return
+/self->trace/
+{
+ self->trace = 0;
+}
+
+pid$1:::entry,
+pid$1:::return
+/self->trace/
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d
new file mode 100644
index 00000000..056329fe
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+int me; /* an integer global variable */
+this int foo; /* an integer clause-local variable */
+
+tick-1sec
+{
+ /*
+ * Set foo to be 10 if and only if this is the first clause executed.
+ */
+ this->foo = (me % 3 == 0) ? 10 : this->foo;
+ printf("Clause 1 is number %d; foo is %d\n", me++ % 3, this->foo++);
+}
+
+tick-1sec
+{
+ /*
+ * Set foo to be 20 if and only if this is the first clause executed.
+ */
+ this->foo = (me % 3 == 0) ? 20 : this->foo;
+ printf("Clause 2 is number %d; foo is %d\n", me++ % 3, this->foo++);
+}
+
+tick-1sec
+{
+ /*
+ * Set foo to be 30 if and only if this is the first clause executed.
+ */
+ this->foo = (me % 3 == 0) ? 30 : this->foo;
+ printf("Clause 3 is number %d; foo is %d\n", me++ % 3, this->foo++);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d
new file mode 100644
index 00000000..e2db52f3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::read:entry
+{
+ self->t = timestamp;
+}
+
+syscall::read:return
+/self->t != 0/
+{
+ printf("%d/%d spent %d nsecs in read(2)\n",
+ pid, tid, timestamp - self->t);
+
+ /*
+ * We're done with this thread-local variable; assign zero to it to
+ * allow the DTrace runtime to reclaim the underlying storage.
+ */
+ self->t = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/soffice.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/soffice.d
new file mode 100644
index 00000000..fa6435cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/soffice.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (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 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+vminfo:::maj_fault,
+vminfo:::zfod,
+vminfo:::as_fault
+/execname == "soffice.bin" && start == 0/
+{
+ /*
+ * This is the first time that a vminfo probe has been hit; record
+ * our initial timestamp.
+ */
+ start = timestamp;
+}
+
+vminfo:::maj_fault,
+vminfo:::zfod,
+vminfo:::as_fault
+/execname == "soffice.bin"/
+{
+ /*
+ * Aggregate on the probename, and lquantize() the number of seconds
+ * since our initial timestamp. (There are 1,000,000,000 nanoseconds
+ * in a second.) We assume that the script will be terminated before
+ * 60 seconds elapses.
+ */
+ @[probename] =
+ lquantize((timestamp - start) / 1000000000, 0, 60);
+}