3 * tcl_flowtime.d - snoop Tcl execution showing procedure flow and delta times.
4 * Written for the Tcl DTrace provider.
6 * $Id: tcl_flowtime.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_flowtime.d # hit Ctrl-C to end
13 * This watches Tcl method entries and returns, and indents child
19 * TIME(us) Time since boot, us
20 * DELTA(us) Elapsed time from previous line to this line
21 * CALL Tcl command or procedure name
29 * WARNING: Watch the first column carefully, it prints the CPU-id. If it
30 * changes, then it is very likely that the output has been shuffled.
32 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
36 * The contents of this file are subject to the terms of the
37 * Common Development and Distribution License, Version 1.0 only
38 * (the "License"). You may not use this file except in compliance
41 * You can obtain a copy of the license at Docs/cddl1.txt
42 * or http://www.opensolaris.org/os/licensing.
43 * See the License for the specific language governing permissions
44 * and limitations under the License.
48 * 09-Sep-2007 Brendan Gregg Created this.
51 #pragma D option quiet
52 #pragma D option switchrate=10
58 printf("%3s %6s %-16s %9s -- %s\n", "C", "PID", "TIME(us)",
68 self->last = timestamp;
73 this->delta = (timestamp - self->last) / 1000;
74 printf("%3d %6d %-16d %9d %*s-> %s\n", cpu, pid, timestamp / 1000,
75 this->delta, self->depth * 2, "", copyinstr(arg0));
77 self->last = timestamp;
82 this->delta = (timestamp - self->last) / 1000;
83 self->depth -= self->depth > 0 ? 1 : 0;
84 printf("%3d %6d %-16d %9d %*s<- %s\n", cpu, pid, timestamp / 1000,
85 this->delta, self->depth * 2, "", copyinstr(arg0));
86 self->last = timestamp;
91 this->delta = (timestamp - self->last) / 1000;
92 printf("%3d %6d %-16d %9d %*s > %s\n", cpu, pid, timestamp / 1000,
93 this->delta, self->depth * 2, "", copyinstr(arg0));
95 self->last = timestamp;
100 this->delta = (timestamp - self->last) / 1000;
101 self->depth -= self->depth > 0 ? 1 : 0;
102 printf("%3d %6d %-16d %9d %*s < %s\n", cpu, pid, timestamp / 1000,
103 this->delta, self->depth * 2, "", copyinstr(arg0));
104 self->last = timestamp;