summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/dtracetoolkit/Tcl
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib/dtracetoolkit/Tcl')
-rw-r--r--cddl/contrib/dtracetoolkit/Tcl/Readme39
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_calldist.d111
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_calls.d63
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_calltime.d123
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_cpudist.d111
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_cputime.d123
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_flow.d86
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_flowtime.d105
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_ins.d57
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_insflow.d123
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_proccalls.d53
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_procflow.d70
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_stat.d137
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_syscalls.d66
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_syscolors.d139
-rwxr-xr-xcddl/contrib/dtracetoolkit/Tcl/tcl_who.d62
16 files changed, 1468 insertions, 0 deletions
diff --git a/cddl/contrib/dtracetoolkit/Tcl/Readme b/cddl/contrib/dtracetoolkit/Tcl/Readme
new file mode 100644
index 0000000..68c7352
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/Readme
@@ -0,0 +1,39 @@
+Tcl - DTracing Tcl Programs
+
+ These scripts trace activity of the Tcl programming language, making use
+ of the Tcl DTrace provider which was integrated into the Tcl source in
+ version tcl8.4.16. See the Tcl DTrace wiki page for details:
+
+ http://wiki.tcl.tk/19923
+
+ This provider was written by Daniel Steffen and is currently available
+ by downloading and compiling the Tcl source with the --enable-dtrace
+ option to configure.
+
+ Since the DTrace Tcl provider could be developed a little further, there is
+ a chance that it has changed slightly by the time you are reading this,
+ causing these scripts to either break or behave oddly. Firstly, check for
+ newer versions of the DTraceToolkit; if it hasn't been updated and you need
+ to use these scripts immediately, then updating them shouldn't take
+ too long. The following was the state of the provider when these scripts
+ were written - check for changes and update the scripts accordingly,
+
+ provider tcl {
+ probe proc-entry(procname, argc, argv);
+ probe proc-return(procname, retcode);
+ probe proc-result(procname, retcode, retval, retobj);
+ probe proc-args(procname, args, ...);
+ probe cmd-entry(cmdname, argc, argv);
+ probe cmd-return(cmdname, retval);
+ probe cmd-args(procname, args, ...);
+ probe inst-start(instname, depth, stackobj);
+ probe inst-done(instname, depth, stackobj);
+ probe obj-create(object);
+ probe obj-free(object);
+ proobe tcl-probe(strings, ...);
+ };
+
+ Update: it looks like two new probes have recently been added to the
+ provider: proc-info and cmd-info. I'll need to update these scripts to
+ make use of these new probes.
+
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_calldist.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_calldist.d
new file mode 100755
index 0000000..47cbd4c
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_calldist.d
@@ -0,0 +1,111 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_calldist.d - measure Tcl elapsed time for different types of operation.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_calldist.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_calldist.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_calldist.d # default, truncate to 10 lines
+ * tcl_calldist.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (proc/cmd/total)
+ * 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;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->proc[self->depth] = timestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->elapsed_incl = timestamp - self->proc[self->depth];
+ this->elapsed_excl = this->elapsed_incl - self->exclude[self->depth];
+ self->proc[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @types_incl[pid, "proc", this->name] =
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[pid, "proc", this->name] =
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] += this->elapsed_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->cmd[self->depth] = timestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->elapsed_incl = timestamp - self->cmd[self->depth];
+ this->elapsed_excl = this->elapsed_incl - self->exclude[self->depth];
+ self->cmd[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @types_incl[pid, "cmd", this->name] =
+ quantize(this->elapsed_incl / 1000);
+ @types_excl[pid, "cmd", this->name] =
+ quantize(this->elapsed_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] += this->elapsed_incl;
+}
+
+dtrace:::END
+{
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive elapsed times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive elapsed times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_incl);
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_calls.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_calls.d
new file mode 100755
index 0000000..755efe7
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_calls.d
@@ -0,0 +1,63 @@
+#!/usr/sbin/dtrace -ZCs
+/*
+ * tcl_calls.d - count Tcl calls (proc/cmd) using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_calls.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_calls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (see below)
+ * NAME Name of proc or cmd call
+ * COUNT Number of calls during sample
+ *
+ * TYPEs:
+ * proc procedure
+ * cmd command
+ *
+ * PORTIONS: 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");
+}
+
+tcl*:::proc-entry
+{
+ @calls[pid, "proc", copyinstr(arg0)] = count();
+}
+
+tcl*:::cmd-entry
+{
+ @calls[pid, "cmd", copyinstr(arg0)] = 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/Tcl/tcl_calltime.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_calltime.d
new file mode 100755
index 0000000..bab2ade
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_calltime.d
@@ -0,0 +1,123 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_calltime.d - measure Tcl elapsed times for different types of operation.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_calltime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_calltime.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_calltime.d # default, truncate to 10 lines
+ * tcl_calltime.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (proc/cmd/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;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->proc[self->depth] = timestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->elapsed_incl = timestamp - self->proc[self->depth];
+ this->elapsed_excl = this->elapsed_incl - self->exclude[self->depth];
+ self->proc[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @num[pid, "proc", this->name] = count();
+ @num[0, "total", "-"] = count();
+ @types_incl[pid, "proc", this->name] = sum(this->elapsed_incl);
+ @types_excl[pid, "proc", this->name] = sum(this->elapsed_excl);
+ @types_excl[0, "total", "-"] = sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] += this->elapsed_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->cmd[self->depth] = timestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->elapsed_incl = timestamp - self->cmd[self->depth];
+ this->elapsed_excl = this->elapsed_incl - self->exclude[self->depth];
+ self->cmd[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @num[pid, "cmd", this->name] = count();
+ @num[0, "total", "-"] = count();
+ @types_incl[pid, "cmd", this->name] = sum(this->elapsed_incl);
+ @types_excl[pid, "cmd", this->name] = sum(this->elapsed_excl);
+ @types_excl[0, "total", "-"] = sum(this->elapsed_excl);
+
+ self->depth--;
+ self->exclude[self->depth] += this->elapsed_incl;
+}
+
+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_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive 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 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/Tcl/tcl_cpudist.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_cpudist.d
new file mode 100755
index 0000000..69f4ba2
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_cpudist.d
@@ -0,0 +1,111 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_cpudist.d - measure Tcl on-CPU time for different types of operation.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_cpudist.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_cpudist.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_cpudist.d # default, truncate to 10 lines
+ * tcl_cpudist.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * 1 Process ID
+ * 2 Type of call (proc/cmd/total)
+ * 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;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->proc[self->depth] = vtimestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->oncpu_incl = vtimestamp - self->proc[self->depth];
+ this->oncpu_excl = this->oncpu_incl - self->exclude[self->depth];
+ self->proc[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @types_incl[pid, "proc", this->name] =
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[pid, "proc", this->name] =
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] += this->oncpu_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->cmd[self->depth] = vtimestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->oncpu_incl = vtimestamp - self->cmd[self->depth];
+ this->oncpu_excl = this->oncpu_incl - self->exclude[self->depth];
+ self->cmd[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @types_incl[pid, "cmd", this->name] =
+ quantize(this->oncpu_incl / 1000);
+ @types_excl[pid, "cmd", this->name] =
+ quantize(this->oncpu_excl / 1000);
+
+ self->depth--;
+ self->exclude[self->depth] += this->oncpu_incl;
+}
+
+dtrace:::END
+{
+ trunc(@types_excl, top);
+ printf("\nTop %d exclusive on-CPU times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_excl);
+
+ trunc(@types_incl, top);
+ printf("\nTop %d inclusive on-CPU times (us),\n", top);
+ printa(" PID=%d, %s, %s %@d\n", @types_incl);
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_cputime.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_cputime.d
new file mode 100755
index 0000000..a29a541
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_cputime.d
@@ -0,0 +1,123 @@
+#!/usr/sbin/dtrace -CZs
+/*
+ * tcl_cputime.d - measure Tcl on-CPU times for different types of operation.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_cputime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * USAGE: tcl_cputime.d [top] # hit Ctrl-C to end
+ * eg,
+ * tcl_cputime.d # default, truncate to 10 lines
+ * tcl_cputime.d 25 # truncate each report section to 25 lines
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * FIELDS:
+ * PID Process ID
+ * TYPE Type of call (proc/cmd/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;
+}
+
+tcl*:::proc-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->proc[self->depth] = vtimestamp;
+}
+
+tcl*:::proc-return
+/self->proc[self->depth]/
+{
+ this->oncpu_incl = vtimestamp - self->proc[self->depth];
+ this->oncpu_excl = this->oncpu_incl - self->exclude[self->depth];
+ self->proc[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @num[pid, "proc", this->name] = count();
+ @num[0, "total", "-"] = count();
+ @types_incl[pid, "proc", this->name] = sum(this->oncpu_incl);
+ @types_excl[pid, "proc", this->name] = sum(this->oncpu_excl);
+ @types_excl[0, "total", "-"] = sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] += this->oncpu_incl;
+}
+
+tcl*:::cmd-entry
+{
+ self->depth++;
+ self->exclude[self->depth] = 0;
+ self->cmd[self->depth] = vtimestamp;
+}
+
+tcl*:::cmd-return
+/self->cmd[self->depth]/
+{
+ this->oncpu_incl = vtimestamp - self->cmd[self->depth];
+ this->oncpu_excl = this->oncpu_incl - self->exclude[self->depth];
+ self->cmd[self->depth] = 0;
+ self->exclude[self->depth] = 0;
+ this->name = copyinstr(arg0);
+
+ @num[pid, "cmd", this->name] = count();
+ @num[0, "total", "-"] = count();
+ @types_incl[pid, "cmd", this->name] = sum(this->oncpu_incl);
+ @types_excl[pid, "cmd", this->name] = sum(this->oncpu_excl);
+ @types_excl[0, "total", "-"] = sum(this->oncpu_excl);
+
+ self->depth--;
+ self->exclude[self->depth] += this->oncpu_incl;
+}
+
+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_excl, top);
+ normalize(@types_excl, 1000);
+ printf("\nTop %d exclusive 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 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/Tcl/tcl_flow.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_flow.d
new file mode 100755
index 0000000..9146828
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_flow.d
@@ -0,0 +1,86 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_flow.d - snoop Tcl execution showing procedure flow using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_flow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_flow.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * CALL Tcl command or procedure name
+ *
+ * LEGEND:
+ * -> procedure entry
+ * <- procedure return
+ * > command entry
+ * < command 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.
+ *
+ * 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
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "CALL");
+}
+
+tcl*:::proc-entry
+{
+ printf("%3d %6d %-16d %*s-> %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+tcl*:::proc-return
+{
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+}
+
+tcl*:::cmd-entry
+{
+ printf("%3d %6d %-16d %*s > %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+tcl*:::cmd-return
+{
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s < %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_flowtime.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_flowtime.d
new file mode 100755
index 0000000..85f1b99
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_flowtime.d
@@ -0,0 +1,105 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_flowtime.d - snoop Tcl execution showing procedure flow and delta times.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_flowtime.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_flowtime.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TIME(us) Time since boot, us
+ * DELTA(us) Elapsed time from previous line to this line
+ * CALL Tcl command or procedure name
+ *
+ * LEGEND:
+ * -> procedure entry
+ * <- procedure return
+ * > command entry
+ * < command 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.
+ *
+ * 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
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s %9s -- %s\n", "C", "PID", "TIME(us)",
+ "DELTA(us)", "CALL");
+}
+
+tcl*:::proc-entry,
+tcl*:::proc-return,
+tcl*:::cmd-entry,
+tcl*:::cmd-return
+/self->last == 0/
+{
+ self->last = timestamp;
+}
+
+tcl*:::proc-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last = timestamp;
+}
+
+tcl*:::proc-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->last = timestamp;
+}
+
+tcl*:::cmd-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %*s > %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last = timestamp;
+}
+
+tcl*:::cmd-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %*s < %s\n", cpu, pid, timestamp / 1000,
+ this->delta, self->depth * 2, "", copyinstr(arg0));
+ self->last = timestamp;
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_ins.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_ins.d
new file mode 100755
index 0000000..39518f9
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_ins.d
@@ -0,0 +1,57 @@
+#!/usr/sbin/dtrace -ZCs
+/*
+ * tcl_ins.d - count Tcl instructions using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_ins.d 64 2007-10-04 08:35:29Z claire $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_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:
+ * inst instruction
+ *
+ * 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");
+}
+
+tcl*:::inst-start
+{
+ @calls[pid, "inst", copyinstr(arg0)] = 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/Tcl/tcl_insflow.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_insflow.d
new file mode 100755
index 0000000..ba5e01c
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_insflow.d
@@ -0,0 +1,123 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_insflow.d - snoop Tcl execution showing procedure flow and delta times.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_insflow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_insflow.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * PID Process ID
+ * TIME(us) Time since boot, us
+ * DELTA(us) Elapsed time from previous line to this line
+ * TYPE Type of call (proc/cmd/inst)
+ * CALL Tcl command or procedure name
+ *
+ * LEGEND:
+ * proc procedure
+ * cmd command
+ * inst instruction
+ *
+ * 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.
+ *
+ * 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
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s %9s %5s -- %s\n", "C", "PID", "TIME(us)",
+ "DELTA(us)", "TYPE", "CALL");
+}
+
+tcl*:::proc-entry,
+tcl*:::proc-return,
+tcl*:::cmd-entry,
+tcl*:::cmd-return
+/self->last == 0/
+{
+ self->last = timestamp;
+}
+
+tcl*:::proc-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %5s %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "proc", self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last = timestamp;
+}
+
+tcl*:::proc-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %5s %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "proc", self->depth * 2, "", copyinstr(arg0));
+ self->last = timestamp;
+}
+
+tcl*:::cmd-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %5s %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "cmd", self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last = timestamp;
+}
+
+tcl*:::cmd-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %5s %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "cmd", self->depth * 2, "", copyinstr(arg0));
+ self->last = timestamp;
+}
+
+tcl*:::inst-start
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%3d %6d %-16d %9d %5s %*s-> %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "inst", self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+ self->last = timestamp;
+}
+
+tcl*:::inst-done
+{
+ this->delta = (timestamp - self->last) / 1000;
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %9d %5s %*s<- %s\n", cpu, pid, timestamp / 1000,
+ this->delta, "inst", self->depth * 2, "", copyinstr(arg0));
+ self->last = timestamp;
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_proccalls.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_proccalls.d
new file mode 100755
index 0000000..c874362
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_proccalls.d
@@ -0,0 +1,53 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_methodcalls.d - count Tcl method calls DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_proccalls.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_methodcalls.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID
+ * COUNT Number of calls during sample
+ * PROCEDURE Tcl procedure 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");
+}
+
+tcl*:::proc-entry
+{
+ @calls[pid, copyinstr(arg0)] = count();
+}
+
+dtrace:::END
+{
+ printf(" %6s %8s %s\n", "PID", "COUNT", "PROCEDURE");
+ printa(" %6d %@8d %s\n", @calls);
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_procflow.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_procflow.d
new file mode 100755
index 0000000..258c198
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_procflow.d
@@ -0,0 +1,70 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_procflow.d - snoop Tcl execution showing procedure flow using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_procflow.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_procflow.d # hit Ctrl-C to end
+ *
+ * This watches Tcl method entries and returns, and indents child
+ * method calls.
+ *
+ * FIELDS:
+ * C CPU-id
+ * TIME(us) Time since boot, us
+ * PID Process ID
+ * PROCEDURE Tcl procedure name
+ *
+ * LEGEND:
+ * -> proc entry
+ * <- proc 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.
+ *
+ * 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
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ printf("%3s %6s %-16s -- %s\n", "C", "PID", "TIME(us)", "PROCEDURE");
+}
+
+tcl*:::proc-entry
+{
+ printf("%3d %6d %-16d %*s-> %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+ self->depth++;
+}
+
+tcl*:::proc-return
+{
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%3d %6d %-16d %*s<- %s\n", cpu, pid, timestamp / 1000,
+ self->depth * 2, "", copyinstr(arg0));
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_stat.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_stat.d
new file mode 100755
index 0000000..a321d70
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_stat.d
@@ -0,0 +1,137 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_stat.d - Tcl operation stats using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_stat.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_stat.d [interval [count]]
+ *
+ * FIELDS:
+ * EXEC/s Tcl programs executed per second, including
+ * those without Tcl provider support
+ * PROC/s Procedures called, per second
+ * CMD/s Commands created, per second
+ * OBJNEW/s Objects created, per second
+ * OBJFRE/s Objects freed, per second
+ * OP/s Bytecode operations, per second
+ *
+ * The numbers are 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 you
+ * may have older Tcl software that does not have the integrated DTrace
+ * provider (or newer software where the provider has changed).
+ *
+ * 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 = procs = cmds = objnew = objfree = ops = 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 %8s\n", "TIME", "EXEC/s",
+ "PROC/s", "CMD/s", "OBJNEW/s", "OBJFRE/s", "OP/s");
+ lines = 0;
+ first = 0;
+}
+
+/*
+ * Tally Data
+ */
+proc:::exec-success
+/execname == "tcl" || execname == "tclsh"/
+{
+ execs++;
+}
+
+tcl*:::proc-entry
+{
+ procs++;
+}
+
+tcl*:::cmd-entry
+{
+ cmds++;
+}
+
+tcl*:::obj-create
+{
+ objnew++;
+}
+
+tcl*:::obj-free
+{
+ objfree++;
+}
+
+tcl*:::inst-start
+{
+ ops++;
+}
+
+/*
+ * Print Output
+ */
+profile:::tick-1sec
+/secs == 0/
+{
+ printf("%-20Y %6d %8d %8d %8d %8d %8d\n", walltimestamp,
+ execs / interval, procs / interval, cmds / interval,
+ objnew / interval, objfree / interval, ops / interval);
+ execs = procs = cmds = objnew = objfree = ops = 0;
+ secs = interval;
+ lines++;
+ counts--;
+}
+
+/*
+ * End
+ */
+profile:::tick-1sec
+/counts == 0/
+{
+ exit(0);
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_syscalls.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_syscalls.d
new file mode 100755
index 0000000..239d7d0
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_syscalls.d
@@ -0,0 +1,66 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_syscalls.d - count Tcl calls and syscalls using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_syscalls.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_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");
+}
+
+tcl$target:::proc-entry
+{
+ @calls[pid, "proc", copyinstr(arg0)] = count();
+}
+
+tcl$target:::cmd-entry
+{
+ @calls[pid, "cmd", copyinstr(arg0)] = 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/Tcl/tcl_syscolors.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_syscolors.d
new file mode 100755
index 0000000..f2529b5
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_syscolors.d
@@ -0,0 +1,139 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_syscolors.d - trace Tcl program flow plus syscalls, in color.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_syscolors.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_syscolors.d { -p PID | -c cmd } # hit Ctrl-C to end
+ *
+ * This watches Tcl 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 (proc/cmd/syscall)
+ * NAME Tcl proc/cmd or syscall name
+ *
+ * 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.
+ *
+ * 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
+
+self int depth;
+
+dtrace:::BEGIN
+{
+ color_tcl = "\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 %9s %-8s -- %s\n", "C", "PID", "DELTA(us)", "TYPE",
+ "NAME");
+}
+
+tcl$target:::method-entry,
+tcl$target:::method-return,
+syscall:::entry,
+syscall:::return
+/self->last == 0 && pid == $target/
+{
+ self->last = timestamp;
+}
+
+tcl$target:::proc-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%s%3d %6d %9d %-8s %*s-> %s%s\n", color_tcl, cpu,
+ pid, this->delta, "proc", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depth++;
+ self->depthlast = self->depth;
+ self->last = timestamp;
+}
+
+tcl$target:::proc-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%s%3d %6d %9d %-8s %*s<- %s%s\n", color_tcl, cpu,
+ pid, this->delta, "proc", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depthlast = self->depth;
+ self->last = timestamp;
+}
+
+tcl$target:::cmd-entry
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%s%3d %6d %9d %-8s %*s-> %s%s\n", color_tcl, cpu,
+ pid, this->delta, "cmd", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depth++;
+ self->depthlast = self->depth;
+ self->last = timestamp;
+}
+
+tcl$target:::cmd-return
+{
+ this->delta = (timestamp - self->last) / 1000;
+ self->depth -= self->depth > 0 ? 1 : 0;
+ printf("%s%3d %6d %9d %-8s %*s<- %s%s\n", color_tcl, cpu,
+ pid, this->delta, "cmd", self->depth * 2, "", copyinstr(arg0),
+ color_off);
+ self->depthlast = self->depth;
+ self->last = timestamp;
+}
+
+syscall:::entry
+/pid == $target/
+{
+ this->delta = (timestamp - self->last) / 1000;
+ printf("%s%3d %6d %9d %-8s %*s-> %s%s\n", color_syscall,
+ cpu, pid, 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 %9d %-8s %*s<- %s%s\n", color_syscall,
+ cpu, pid, this->delta, "syscall", self->depthlast * 2, "",
+ probefunc, color_off);
+ self->last = timestamp;
+}
+
+proc:::exit
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/cddl/contrib/dtracetoolkit/Tcl/tcl_who.d b/cddl/contrib/dtracetoolkit/Tcl/tcl_who.d
new file mode 100755
index 0000000..424ad31
--- /dev/null
+++ b/cddl/contrib/dtracetoolkit/Tcl/tcl_who.d
@@ -0,0 +1,62 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * tcl_who.d - trace Tcl calls by process using DTrace.
+ * Written for the Tcl DTrace provider.
+ *
+ * $Id: tcl_who.d 63 2007-10-04 04:34:38Z brendan $
+ *
+ * This traces activity from all Tcl processes on the system with DTrace
+ * provider support (tcl8.4.16).
+ *
+ * USAGE: tcl_who.d # hit Ctrl-C to end
+ *
+ * FIELDS:
+ * PID Process ID of Tcl
+ * UID User ID of the owner
+ * CALLS Number of calls made (proc + cmd)
+ * ARGS Process name and arguments
+ *
+ * Calls is a measure of activity, and is a count of the procedures and
+ * commands that Tcl called.
+ *
+ * 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");
+}
+
+tcl*:::proc-entry,
+tcl*:::cmd-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