3 * tcl_syscalls.d - count Tcl calls and syscalls using DTrace.
4 * Written for the Tcl DTrace provider.
6 * $Id: tcl_syscalls.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_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
15 * TYPE Type of call (method/syscall)
17 * COUNT Number of calls during sample
19 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
23 * The contents of this file are subject to the terms of the
24 * Common Development and Distribution License, Version 1.0 only
25 * (the "License"). You may not use this file except in compliance
28 * You can obtain a copy of the license at Docs/cddl1.txt
29 * or http://www.opensolaris.org/os/licensing.
30 * See the License for the specific language governing permissions
31 * and limitations under the License.
35 * 09-Sep-2007 Brendan Gregg Created this.
38 #pragma D option quiet
42 printf("Tracing... Hit Ctrl-C to end.\n");
45 tcl$target:::proc-entry
47 @calls[pid, "proc", copyinstr(arg0)] = count();
50 tcl$target:::cmd-entry
52 @calls[pid, "cmd", copyinstr(arg0)] = count();
58 @calls[pid, "syscall", probefunc] = count();
64 printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
65 printa(" %6d %-8s %-52s %@8d\n", @calls);