1#!/usr/sbin/dtrace -Zs
2/*
3 * tcl_methodcalls.d - count Tcl method calls DTrace.
4 *                     Written for the Tcl DTrace provider.
5 *
6 * $Id: tcl_proccalls.d 63 2007-10-04 04:34:38Z brendan $
7 *
8 * This traces activity from all Tcl processes on the system with DTrace
9 * provider support (tcl8.4.16).
10 *
11 * USAGE: tcl_methodcalls.d 	# hit Ctrl-C to end
12 *
13 * FIELDS:
14 *		PID		Process ID
15 *		COUNT		Number of calls during sample
16 *		PROCEDURE	Tcl procedure name
17 *
18 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
19 *
20 * CDDL HEADER START
21 *
22 *  The contents of this file are subject to the terms of the
23 *  Common Development and Distribution License, Version 1.0 only
24 *  (the "License").  You may not use this file except in compliance
25 *  with the License.
26 *
27 *  You can obtain a copy of the license at Docs/cddl1.txt
28 *  or http://www.opensolaris.org/os/licensing.
29 *  See the License for the specific language governing permissions
30 *  and limitations under the License.
31 *
32 * CDDL HEADER END
33 *
34 * 09-Sep-2007	Brendan Gregg	Created this.
35 */
36
37#pragma D option quiet
38
39dtrace:::BEGIN
40{
41	printf("Tracing... Hit Ctrl-C to end.\n");
42}
43
44tcl*:::proc-entry
45{
46	@calls[pid, copyinstr(arg0)] = count();
47}
48
49dtrace:::END
50{
51	printf(" %6s %8s %s\n", "PID", "COUNT", "PROCEDURE");
52	printa(" %6d %@8d %s\n", @calls);
53}
54