summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/dtracetoolkit/dist/Java
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2012-05-12 21:15:21 +0000
committergnn <gnn@FreeBSD.org>2012-05-12 21:15:21 +0000
commit34bfc80a6503ab72d3c20c4902f3e4d7ec9cd209 (patch)
tree7f4daef38dfde1923927c64e2bae2ae7f8c1225f /cddl/contrib/dtracetoolkit/dist/Java
parent75fa27bcfce0da47ad015b3aca358721443edce1 (diff)
parent4297c1b2d07fec7f50b70e26e3adb4d062b19e15 (diff)
downloadFreeBSD-src-34bfc80a6503ab72d3c20c4902f3e4d7ec9cd209.zip
FreeBSD-src-34bfc80a6503ab72d3c20c4902f3e4d7ec9cd209.tar.gz
Import dtracetoolkit into cddl/contrib
Diffstat (limited to 'cddl/contrib/dtracetoolkit/dist/Java')
-rw-r--r--cddl/contrib/dtracetoolkit/dist/Java/Readme17
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_calldist.d116
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_calls.d113
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_calltime.d129
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_classflow.d100
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_cpudist.d116
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_cputime.d129
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_events.d56
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_flow.d87
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_flowtime.d101
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_methodcalls.d60
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_objnew.d61
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_package.d56
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_profile.d78
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_stat.d148
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_syscalls.d68
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_syscolors.d135
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_thread.d64
-rwxr-xr-xcddl/contrib/dtracetoolkit/dist/Java/j_who.d58
19 files changed, 1692 insertions, 0 deletions
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/Readme b/cddl/contrib/dtracetoolkit/dist/Java/Readme
new file mode 100644
index 0000000..ae455a5
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/Readme
@@ -0,0 +1,17 @@
+Java - DTracing Java
+
+ These scripts trace the JVM, and require the Java hotspot provider which
+ was shipped with Java starting with version 1.6.0.
+
+ Some of these scripts measure method and object events, and require
+ the Java process to be run using the "+ExtendedDTraceProbes" flag.
+ For example,
+
+ java -XX:+ExtendedDTraceProbes classfile
+
+ The ExtendedDTraceProbes flag is not on by default to avoid the additional
+ overhead for maintaining these additional probes. When this flag is
+ enabled, the JVM may execute slightly slower than before; when the probes
+ are also enabled (especially method probes), the JVM may execute
+ significantly slower.
+
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_calldist.d b/cddl/contrib/dtracetoolkit/dist/Java/j_calldist.d
new file mode 100755
index 0000000..f0cb087
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_calldist.d
@@ -0,0 +1,116 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_calldist.d - measure Java elapsed times for different types of operation.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_calldist.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_calldist.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (method/gc)
+ * 3 Name of call
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top = $1 != 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+ self->method[arg0, self->depth[arg0]] = timestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->elapsed_incl = timestamp - self->method[arg0, self->depth[arg0]];
+ this->elapsed_excl = this->elapsed_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] = 0;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @types_incl[pid, "method", this->name] =
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[pid, "method", this->name] =
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] += this->elapsed_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc = timestamp;
+ self->full = (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->elapsed = timestamp - self->gc;
+
+ @types[pid, "gc", self->full == B_FALSE ? "GC" : "Full GC"] =
+ quantize(this->elapsed / 1000);
+
+ self->gc = 0;
+ self->full = 0;
+}
+
+dtrace:::END
+{
+ trunc(@types, top);
+ printf("\nTop %d elapsed times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types);
+
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive method elapsed times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive method elapsed times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_incl);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_calls.d b/cddl/contrib/dtracetoolkit/dist/Java/j_calls.d
new file mode 100755
index 0000000..087545d
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_calls.d
@@ -0,0 +1,113 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_calls.d - count Java calls (method/...) using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_calls.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls and object allocation are only
+ * visible when using the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (see below)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * TYPEs:
+ * cload class load
+ * method method call
+ * mcompile method compile
+ * mload compiled method load
+ * oalloc object alloc
+ * thread thread start
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::method-entry
+{
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "method", this->name] = count();
+}
+
+hotspot*:::object-alloc
+{
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ @calls[pid, "oalloc", stringof(this->class)] = count();
+}
+
+hotspot*:::class-loaded
+{
+ this->class = (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] = '\0';
+ @calls[pid, "cload", stringof(this->class)] = count();
+}
+
+hotspot*:::thread-start
+{
+ this->thread = (char *)copyin(arg0, arg1 + 1);
+ this->thread[arg1] = '\0';
+ @calls[pid, "thread", stringof(this->thread)] = count();
+}
+
+hotspot*:::method-compile-begin
+{
+ this->class = (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] = '\0';
+ this->method = (char *)copyin(arg2, arg3 + 1);
+ this->method[arg3] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "mcompile", this->name] = count();
+}
+
+hotspot*:::compiled-method-load
+{
+ this->class = (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] = '\0';
+ this->method = (char *)copyin(arg2, arg3 + 1);
+ this->method[arg3] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "mload", this->name] = count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-8s %-52s %@8d\n", @calls);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_calltime.d b/cddl/contrib/dtracetoolkit/dist/Java/j_calltime.d
new file mode 100755
index 0000000..be4da51
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_calltime.d
@@ -0,0 +1,129 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_calltime.d - measure Java elapsed times for different types of operation.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_calltime.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_calltime.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (method/gc/total)
+ * NAME Name of call
+ * TOTAL Total elapsed time for calls (us)
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top = $1 != 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+ self->method[arg0, self->depth[arg0]] = timestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->elapsed_incl = timestamp - self->method[arg0, self->depth[arg0]];
+ this->elapsed_excl = this->elapsed_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] = 0;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @num[pid, "method", this->name] = count();
+ @num[0, "total", "-"] = count();
+ @types_incl[pid, "method", this->name] = sum(this->elapsed_incl);
+ @types_excl[pid, "method", this->name] = sum(this->elapsed_excl);
+ @types_excl[0, "total", "-"] = sum(this->elapsed_excl);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] += this->elapsed_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc = timestamp;
+ self->full = (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->elapsed = timestamp - self->gc;
+ self->gc = 0;
+
+ @num[pid, "gc", self->full == B_FALSE ? "GC" : "Full GC"] = count();
+ @types[pid, "gc", self->full == B_FALSE ? "GC" : "Full GC"] =
+ sum(this->elapsed);
+ self->full = 0;
+}
+
+dtrace:::END
+{
+ trunc(@num, top);
+ printf("\nTop %d counts,\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-10s %-48s %@8d\n", @num);
+
+ trunc(@types, top);
+ normalize(@types, 1000);
+ printf("\nTop %d elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types);
+
+ trunc(@types_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive method elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ normalize(@types_incl, 1000);
+ printf("\nTop %d inclusive method elapsed times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_incl);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_classflow.d b/cddl/contrib/dtracetoolkit/dist/Java/j_classflow.d
new file mode 100755
index 0000000..162338a
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_classflow.d
@@ -0,0 +1,100 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_classflow.d - trace a Java class method flow using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_classflow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_classflow.d classname # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * CLASS.METHOD Java class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thread
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=16m
+#pragma D option quiet
+#pragma D option defaultargs
+#pragma D option switchrate=10
+
+self int depth[int];
+
+dtrace:::BEGIN
+/$$1 == ""/
+{
+ printf("USAGE: j_classflow.d classname\n");
+ exit(1);
+}
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "CLASS.METHOD");
+}
+
+hotspot*:::method-entry,
+hotspot*:::method-return
+{
+ this->class = stringof((char *)copyin(arg1, arg2 + 1));
+ this->class[arg2] = '\0';
+}
+
+hotspot*:::method-entry
+/this->class == $$1/
+{
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ printf("%3d %6d %-16d %*s-> %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+ self->depth[arg0]++;
+}
+
+hotspot*:::method-return
+/this->class == $$1/
+{
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ self->depth[arg0] -= self->depth[arg0] > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_cpudist.d b/cddl/contrib/dtracetoolkit/dist/Java/j_cpudist.d
new file mode 100755
index 0000000..9a4626e
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_cpudist.d
@@ -0,0 +1,116 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_cpudist.d - measure Java on-CPU times for different types of operation.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_cpudist.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_cpudist.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (method/gc)
+ * 3 Name of call
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top = $1 != 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+ self->method[arg0, self->depth[arg0]] = vtimestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->oncpu_incl = vtimestamp - self->method[arg0, self->depth[arg0]];
+ this->oncpu_excl = this->oncpu_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] = 0;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @types_incl[pid, "method", this->name] =
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[pid, "method", this->name] =
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] += this->oncpu_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc = vtimestamp;
+ self->full = (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->oncpu = vtimestamp - self->gc;
+
+ @types[pid, "gc", self->full == B_FALSE ? "GC" : "Full GC"] =
+ quantize(this->oncpu / 1000);
+
+ self->gc = 0;
+ self->full = 0;
+}
+
+dtrace:::END
+{
+ trunc(@types, top);
+ printf("\nTop %d on-CPU times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types);
+
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive method on-CPU times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive method on-CPU times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_incl);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_cputime.d b/cddl/contrib/dtracetoolkit/dist/Java/j_cputime.d
new file mode 100755
index 0000000..a720cdb
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_cputime.d
@@ -0,0 +1,129 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_cputime.d - measure Java on-CPU times for different types of operation.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_cputime.d 59 2007-10-03 08:21:58Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls are only visible when using the
+ * flag "+ExtendedDTraceProbes". eg, java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_cputime.d [top] # hit Ctrl-C to end
+ *
+ * The "top" optional argument will truncate the output for each report
+ * section to that many lines, with a default of 10.
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (method/gc/total)
+ * NAME Name of call
+ * TOTAL Total on-CPU time for calls (us)
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#define TOP 10 /* default output truncation */
+#define B_FALSE 0
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+ top = $1 != 0 ? $1 : TOP;
+}
+
+hotspot*:::method-entry
+{
+ self->depth[arg0]++;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+ self->method[arg0, self->depth[arg0]] = vtimestamp;
+}
+
+hotspot*:::method-return
+/self->method[arg0, self->depth[arg0]]/
+{
+ this->oncpu_incl = vtimestamp - self->method[arg0, self->depth[arg0]];
+ this->oncpu_excl = this->oncpu_incl -
+ self->exclude[arg0, self->depth[arg0]];
+ self->method[arg0, self->depth[arg0]] = 0;
+ self->exclude[arg0, self->depth[arg0]] = 0;
+
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+
+ @num[pid, "method", this->name] = count();
+ @num[0, "total", "-"] = count();
+ @types_incl[pid, "method", this->name] = sum(this->oncpu_incl);
+ @types_excl[pid, "method", this->name] = sum(this->oncpu_excl);
+ @types_excl[0, "total", "-"] = sum(this->oncpu_excl);
+
+ self->depth[arg0]--;
+ self->exclude[arg0, self->depth[arg0]] += this->oncpu_incl;
+}
+
+hotspot*:::gc-begin
+{
+ self->gc = vtimestamp;
+ self->full = (boolean_t)arg0;
+}
+
+hotspot*:::gc-end
+/self->gc/
+{
+ this->oncpu = vtimestamp - self->gc;
+ self->gc = 0;
+
+ @num[pid, "gc", self->full == B_FALSE ? "GC" : "Full GC"] = count();
+ @types[pid, "gc", self->full == B_FALSE ? "GC" : "Full GC"] =
+ sum(this->oncpu);
+ self->full = 0;
+}
+
+dtrace:::END
+{
+ trunc(@num, top);
+ printf("\nTop %d counts,\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-10s %-48s %@8d\n", @num);
+
+ trunc(@types, top);
+ normalize(@types, 1000);
+ printf("\nTop %d on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types);
+
+ trunc(@types_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive method on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ normalize(@types_incl, 1000);
+ printf("\nTop %d inclusive method on-CPU times (us),\n", top);
+ printf(" %6s %-10s %-48s %8s\n", "PID", "TYPE", "NAME", "TOTAL");
+ printa(" %6d %-10s %-48s %@8d\n", @types_incl);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_events.d b/cddl/contrib/dtracetoolkit/dist/Java/j_events.d
new file mode 100755
index 0000000..d8c938b
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_events.d
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_events.d - count Java events using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_events.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Some events such as method calls are only
+ * visible when using the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_events.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * EVENT Event name (DTrace probe name)
+ * COUNT Number of calls during sample
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+/* this matches both hotspot and hotspot_jni providers */
+hotspot*:::
+{
+ @calls[pid, probename] = count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %-36s %8s\n", "PID", "EVENT", "COUNT");
+ printa(" %6d %-36s %@8d\n", @calls);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_flow.d b/cddl/contrib/dtracetoolkit/dist/Java/j_flow.d
new file mode 100755
index 0000000..e98c067
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_flow.d
@@ -0,0 +1,87 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_flow.d - snoop Java execution showing method flow using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_flow.d 38 2007-09-16 08:17:41Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_flow.d # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * CLASS.METHOD Java class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thread
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=16m
+#pragma D option quiet
+#pragma D option switchrate=10
+
+self int depth[int];
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "CLASS.METHOD");
+}
+
+hotspot*:::method-entry
+{
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ printf("%3d %6d %-16d %*s-> %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+ self->depth[arg0]++;
+}
+
+hotspot*:::method-return
+{
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ self->depth[arg0] -= self->depth[arg0] > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s.%s\n", cpu, pid, timestamp / 1000,
+ self->depth[arg0] * 2, "", stringof(this->class),
+ stringof(this->method));
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_flowtime.d b/cddl/contrib/dtracetoolkit/dist/Java/j_flowtime.d
new file mode 100755
index 0000000..53e75cd
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_flowtime.d
@@ -0,0 +1,101 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_flowtime.d - snoop Java execution with method flow and delta times.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_flowtime.d 41 2007-09-17 02:20:10Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TID Thread ID
+ * TIME(us) Time since boot (us)
+ * DELTA(us) Elapsed time from previous line to this line
+ * CLASS.METHOD Java class and method name
+ *
+ * LEGEND:
+ * -> method entry
+ * <- method return
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thread
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=16m
+#pragma D option quiet
+#pragma D option switchrate=10
+
+self int depth[int];
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s/%-5s %-16s %9s -- %s\n", "C", "PID", "TID", "TIME(us)",
+ "DELTA(us)", "CLASS.METHOD");
+}
+
+hotspot*:::method-entry,
+hotspot*:::method-return
+/self->last == 0/
+{
+ self->last = timestamp;
+}
+
+hotspot*:::method-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ printf("%3d %6d/%-5d %-16d %9d %*s-> %s.%s\n", cpu, pid, tid,
+ timestamp / 1000, this->delta, self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method));
+ self->depth[arg0]++;
+ self->last = timestamp;
+}
+
+hotspot*:::method-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ self->depth[arg0] -= self->depth[arg0] > 0 ? 1 : 0;
+ printf("%3d %6d/%-5d %-16d %9d %*s<- %s.%s\n", cpu, pid, tid,
+ timestamp / 1000, this->delta, self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method));
+ self->last = timestamp;
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_methodcalls.d b/cddl/contrib/dtracetoolkit/dist/Java/j_methodcalls.d
new file mode 100755
index 0000000..606b820
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_methodcalls.d
@@ -0,0 +1,60 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_methodcalls.d - count Java method calls DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_methodcalls.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_methodcalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * COUNT Number of calls during sample
+ * CLASS.METHOD Java class and method name
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::method-entry
+{
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, this->name] = count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %8s %s\n", "PID", "COUNT", "CLASS.METHOD");
+ printa(" %6d %@8d %s\n", @calls);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_objnew.d b/cddl/contrib/dtracetoolkit/dist/Java/j_objnew.d
new file mode 100755
index 0000000..8847005
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_objnew.d
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_objnew.d - report Java object allocation using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_objnew.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_objnew.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * OBJS Number of objects created
+ * CLASS.METHOD Java class and method name
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::object-alloc
+{
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ @objs[pid, stringof(this->class)] = count();
+ @dist[pid, stringof(this->class)] = quantize(arg3);
+}
+
+dtrace:::END
+{
+ printf("Java object allocation byte distributions by pid and class,\n");
+ printa(@dist);
+
+ printf("Java object allocation count by pid and class,\n\n");
+ printf(" %6s %8s %s\n", "PID", "OBJS", "CLASS");
+ printa(" %6d %8@d %s\n", @objs);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_package.d b/cddl/contrib/dtracetoolkit/dist/Java/j_package.d
new file mode 100755
index 0000000..cfeaf05
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_package.d
@@ -0,0 +1,56 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_package.d - count Java class loads by package using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_package.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0).
+ *
+ * USAGE: j_package.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * LOADS Class loads during trace
+ * PACKAGE Package name from class
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::class-loaded
+{
+ this->class = (char *)copyin(arg0, arg1 + 1);
+ this->class[arg1] = '\0';
+
+ @loads[pid, dirname(stringof(this->class))] = count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %8s %s\n", "PID", "LOADS", "PACKAGE");
+ printa(" %6d %@8d %s\n", @loads);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_profile.d b/cddl/contrib/dtracetoolkit/dist/Java/j_profile.d
new file mode 100755
index 0000000..4ff009e
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_profile.d
@@ -0,0 +1,78 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * j_profile.d - sample stack traces with Java translations using DTrace.
+ *
+ * USAGE: j_profile.d { -p PID | -c cmd } # hit Ctrl-C to end
+ * $Id: j_profile.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ *
+ * This samples stack traces for the process specified. This stack trace
+ * will cross the JVM and system libraries, and insert translations for Java
+ * stack frames where appropriate. This is best explained with an example
+ * stack frame output,
+ *
+ * Func_loop.func_c()V
+ * Func_loop.func_b()V
+ * Func_loop.func_a()V
+ * Func_loop.main([Ljava/lang/String;)V
+ * StubRoutines (1)
+ * libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethodHan
+ * libjvm.so`__1cCosUos_exception_wrapper6FpFpnJJavaValue_pnMmetho
+ * libjvm.so`__1cJJavaCallsEcall6FpnJJavaValue_nMmethodHandle_pnRJ
+ * libjvm.so`__1cRjni_invoke_static6FpnHJNIEnv__pnJJavaValue_pnI_j
+ * libjvm.so`jni_CallStaticVoidMethod+0x15d
+ * java`JavaMain+0xd30
+ * libc.so.1`_thr_setup+0x52
+ * libc.so.1`_lwp_start
+ * 101
+ *
+ * The lines at the top are Java frames, followed by the JVM (libjvm.so).
+ * The JVM symbols may be translated by passing the output through c++filt.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option jstackstrsize=1024
+
+/*
+ * Tunables
+ */
+#define DEPTH 10 /* stack depth, frames */
+#define RATE 101 /* sampling rate, Hertz */
+#define TOP 25 /* number of stacks to output */
+
+dtrace:::BEGIN
+{
+ printf("Sampling %d-level stacks at %d Hertz... Hit Ctrl-C to end.\n",
+ DEPTH, RATE);
+}
+
+profile-RATE
+/pid == $target/
+{
+ @stacks[jstack(DEPTH)] = count();
+}
+
+dtrace:::END
+{
+ trunc(@stacks, TOP);
+ printf("Top %d most frequently sampled stacks,\n", TOP);
+ printa(@stacks);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_stat.d b/cddl/contrib/dtracetoolkit/dist/Java/j_stat.d
new file mode 100755
index 0000000..862fe31
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_stat.d
@@ -0,0 +1,148 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_stat.d - Java operation stats using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_stat.d 64 2007-10-04 08:35:29Z claire $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0). Method calls and object allocation are only
+ * visible when using the flag "+ExtendedDTraceProbes". eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_stat.d [interval [count]]
+ *
+ * FIELDS:
+ * EXEC/s Java programs executed per second, including
+ * those without Java provider support
+ * THREAD/s Threads created, per second
+ * METHOD/s Methods called, per second
+ * OBJNEW/s Objects created, per second
+ * CLOAD/s Class loads, per second
+ * EXCP/s Exceptions raised, per second
+ * GC/s Garbage collects, per second
+ *
+ * The numbers are per second counts for the interval specified. The default
+ * interval is 1 second.
+ *
+ * If you see a count in "EXECS" but not in the other columns, then your
+ * Java software is probably not running with the DTrace hotspot provider.
+ *
+ * If you see counts in "CLOAD" but not in "METHODS", then you Java
+ * software probably isn't running with "+ExtendedDTraceProbes".
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+
+inline int SCREEN = 21;
+
+dtrace:::BEGIN
+{
+ execs = threads = methods = objnew = cload = gc = exception = 0;
+ lines = SCREEN + 1;
+ interval = $1 ? $1 : 1;
+ counts = $2 ? $2 : -1;
+ secs = interval;
+ first = 1;
+}
+
+profile:::tick-1sec
+{
+ secs--;
+}
+
+/*
+ * Print Header
+ */
+dtrace:::BEGIN,
+profile:::tick-1sec
+/first || (secs == 0 && lines > SCREEN)/
+{
+ printf("%-20s %6s %8s %8s %8s %8s %6s %6s\n", "TIME", "EXEC/s",
+ "THREAD/s", "METHOD/s", "OBJNEW/s", "CLOAD/s", "EXCP/s", "GC/s");
+ lines = 0;
+ first = 0;
+}
+
+/*
+ * Tally Data
+ */
+proc:::exec-success
+/execname == "java"/
+{
+ execs++;
+}
+
+hotspot*:::thread-start
+{
+ threads++;
+}
+
+hotspot*:::method-entry
+{
+ methods++;
+}
+
+hotspot*:::object-alloc
+{
+ oalloc++;
+}
+
+hotspot*:::class-loaded
+{
+ cload++;
+}
+
+hotspot*:::gc-begin
+{
+ gc++;
+}
+
+hotspot*:::ExceptionOccurred-entry
+{
+ exception++;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs == 0/
+{
+ printf("%-20Y %6d %8d %8d %8d %8d %6d %6d\n", walltimestamp,
+ execs / interval, threads / interval, methods / interval,
+ oalloc / interval, cload / interval, exception / interval,
+ gc / interval);
+ execs = threads = methods = oalloc = cload = gc = exception = 0;
+ secs = interval;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts == 0/
+{
+ exit(0);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_syscalls.d b/cddl/contrib/dtracetoolkit/dist/Java/j_syscalls.d
new file mode 100755
index 0000000..4a24dea
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_syscalls.d
@@ -0,0 +1,68 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_syscalls.d - count Java methods and syscalls using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_syscalls.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces Java methods if the hotspot provider exists (1.6.0) and
+ * the flag "+ExtendedDTraceProbes" is used. eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (method/syscall)
+ * NAME Name of call
+ * COUNT Number of calls during sample
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot$target:::method-entry
+{
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+ this->name = strjoin(strjoin(stringof(this->class), "."),
+ stringof(this->method));
+ @calls[pid, "method", this->name] = count();
+}
+
+syscall:::entry
+/pid == $target/
+{
+ @calls[pid, "syscall", probefunc] = count();
+}
+
+
+dtrace:::END
+{
+ printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
+ printa(" %6d %-8s %-52s %@8d\n", @calls);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_syscolors.d b/cddl/contrib/dtracetoolkit/dist/Java/j_syscolors.d
new file mode 100755
index 0000000..691ae7e
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_syscolors.d
@@ -0,0 +1,135 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_syscolors.d - trace Java method flow plus syscalls, in color.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_syscolors.d 58 2007-10-01 13:36:29Z brendan $
+ *
+ * This traces Java methods if the hotspot provider exists (1.6.0) and
+ * the flag "+ExtendedDTraceProbes" is used. eg,
+ * java -XX:+ExtendedDTraceProbes classfile
+ *
+ * USAGE: j_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches Java method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TID Thread ID
+ * DELTA(us) Elapsed time from previous line to this line
+ * TYPE Type of call (func/syscall)
+ * NAME Java method or syscall name
+ *
+ * If the flow appears to jump, check the TID column - the JVM may have
+ * switched to another thread.
+ *
+ * WARNING: Watch the first column carefully, it prints the CPU-id. If it
+ * changes, then it is very likely that the output has been shuffled.
+ * Changes in TID will appear to shuffle output, as we change from one thread
+ * depth to the next. See Docs/Notes/ALLjavaflow.txt for additional notes.
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+/* increasing bufsize can reduce drops */
+#pragma D option bufsize=32m
+#pragma D option quiet
+#pragma D option switchrate=10
+
+self int depth[int];
+
+dtrace:::BEGIN
+{
+ color_java = "\033[2;35m"; /* violet, faint */
+ color_line = "\033[1;35m"; /* violet, bold */
+ color_syscall = "\033[2;32m"; /* green, faint */
+ color_off = "\033[0m"; /* default */
+
+ printf("%3s %6s/%-5s %9s %-8s -- %s\n", "C", "PID", "TID", "DELTA(us)",
+ "TYPE", "NAME");
+}
+
+hotspot$target:::method-entry,
+hotspot$target:::method-return,
+syscall:::entry,
+syscall:::return
+/self->last == 0 && pid == $target/
+{
+ self->last = timestamp;
+}
+
+hotspot$target:::method-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ printf("%s%3d %6d/%-5d %9d %-8s %*s-> %s.%s%s\n", color_java, cpu,
+ pid, tid, this->delta, "method", self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method), color_off);
+ self->depth[arg0]++;
+ self->depthlast = self->depth[arg0];
+ self->last = timestamp;
+}
+
+hotspot$target:::method-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ this->class = (char *)copyin(arg1, arg2 + 1);
+ this->class[arg2] = '\0';
+ this->method = (char *)copyin(arg3, arg4 + 1);
+ this->method[arg4] = '\0';
+
+ self->depth[arg0] -= self->depth[arg0] > 0 ? 1 : 0;
+ printf("%s%3d %6d/%-5d %9d %-8s %*s<- %s.%s%s\n", color_java, cpu,
+ pid, tid, this->delta, "method", self->depth[arg0] * 2, "",
+ stringof(this->class), stringof(this->method), color_off);
+ self->depthlast = self->depth[arg0];
+ self->last = timestamp;
+}
+
+syscall:::entry
+/pid == $target/
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%s%3d %6d/%-5d %9d %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, tid, this->delta, "syscall", self->depthlast * 2, "",
+ probefunc, color_off);
+ self->last = timestamp;
+}
+
+syscall:::return
+/pid == $target/
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%s%3d %6d/%-5d %9d %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, tid, this->delta, "syscall", self->depthlast * 2, "",
+ probefunc, color_off);
+ self->last = timestamp;
+}
+
+proc:::exit
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_thread.d b/cddl/contrib/dtracetoolkit/dist/Java/j_thread.d
new file mode 100755
index 0000000..08d2de8
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_thread.d
@@ -0,0 +1,64 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_thread.d - snoop Java thread execution using DTrace.
+ Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_thread.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0).
+ *
+ * USAGE: j_thread.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * TIME Time string
+ * PID Process ID
+ * TID Thread ID
+ * THREAD Thread name
+ *
+ * LEGEND:
+ * => thread start
+ * <= thread end
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10
+
+dtrace:::BEGIN
+{
+ printf("%-20s %6s/%-5s -- %s\n", "TIME", "PID", "TID", "THREAD");
+}
+
+hotspot*:::thread-start
+{
+ this->thread = (char *)copyin(arg0, arg1 + 1);
+ this->thread[arg1] = '\0';
+ printf("%-20Y %6d/%-5d => %s\n", walltimestamp, pid, tid,
+ stringof(this->thread));
+}
+
+hotspot*:::thread-stop
+{
+ this->thread = (char *)copyin(arg0, arg1 + 1);
+ this->thread[arg1] = '\0';
+ printf("%-20Y %6d/%-5d <= %s\n", walltimestamp, pid, tid,
+ stringof(this->thread));
+}
diff --git a/cddl/contrib/dtracetoolkit/dist/Java/j_who.d b/cddl/contrib/dtracetoolkit/dist/Java/j_who.d
new file mode 100755
index 0000000..8785cca
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/dist/Java/j_who.d
@@ -0,0 +1,58 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * j_who.d - trace Java calls by process using DTrace.
+ * Written for the Java hotspot DTrace provider.
+ *
+ * $Id: j_who.d 19 2007-09-12 07:47:59Z brendan $
+ *
+ * This traces activity from all Java processes on the system with hotspot
+ * provider support (1.6.0).
+ *
+ * USAGE: j_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of Java
+ * UID User ID of the owner
+ * CALLS Number of calls made (a measure of activity)
+ * ARGS Process name and arguments
+ *
+ * The argument list is truncated at 55 characters (up to 80 is easily
+ * available). To easily read the full argument list, use other system tools;
+ * on Solaris use "pargs PID".
+ *
+ * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
+ *
+ * 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 Docs/cddl1.txt
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * CDDL HEADER END
+ *
+ * 09-Sep-2007 Brendan Gregg Created this.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+ printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+hotspot*:::Call*-entry
+{
+ @calls[pid, uid, curpsinfo->pr_psargs] = count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %6s %6s %-55s\n", "PID", "UID", "CALLS", "ARGS");
+ printa(" %6d %6d %@6d %-55.55s\n", @calls);
+}
OpenPOWER on IntegriCloud