3 * tcl_stat.d - Tcl operation stats using DTrace.
4 * Written for the Tcl DTrace provider.
6 * $Id: tcl_stat.d 63 2007-10-04 04:34:38Z brendan $
8 * This traces activity from all Tcl processes on the system with DTrace
9 * provider support (tcl8.4.16).
11 * USAGE: tcl_stat.d [interval [count]]
14 * EXEC/s Tcl programs executed per second, including
15 * those without Tcl provider support
16 * PROC/s Procedures called, per second
17 * CMD/s Commands created, per second
18 * OBJNEW/s Objects created, per second
19 * OBJFRE/s Objects freed, per second
20 * OP/s Bytecode operations, per second
22 * The numbers are counts for the interval specified. The default interval
25 * If you see a count in "EXECS" but not in the other columns, then you
26 * may have older Tcl software that does not have the integrated DTrace
27 * provider (or newer software where the provider has changed).
29 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
33 * The contents of this file are subject to the terms of the
34 * Common Development and Distribution License, Version 1.0 only
35 * (the "License"). You may not use this file except in compliance
38 * You can obtain a copy of the license at Docs/cddl1.txt
39 * or http://www.opensolaris.org/os/licensing.
40 * See the License for the specific language governing permissions
41 * and limitations under the License.
45 * 09-Sep-2007 Brendan Gregg Created this.
48 #pragma D option quiet
49 #pragma D option defaultargs
51 inline int SCREEN = 21;
55 execs = procs = cmds = objnew = objfree = ops = 0;
57 interval = $1 ? $1 : 1;
58 counts = $2 ? $2 : -1;
73 /first || (secs == 0 && lines > SCREEN)/
75 printf("%-20s %6s %8s %8s %8s %8s %8s\n", "TIME", "EXEC/s",
76 "PROC/s", "CMD/s", "OBJNEW/s", "OBJFRE/s", "OP/s");
85 /execname == "tcl" || execname == "tclsh"/
121 printf("%-20Y %6d %8d %8d %8d %8d %8d\n", walltimestamp,
122 execs / interval, procs / interval, cmds / interval,
123 objnew / interval, objfree / interval, ops / interval);
124 execs = procs = cmds = objnew = objfree = ops = 0;