tcl_who.d revision 272461
1#!/usr/sbin/dtrace -Zs 2/* 3 * tcl_who.d - trace Tcl calls by process using DTrace. 4 * Written for the Tcl DTrace provider. 5 * 6 * $Id: tcl_who.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_who.d # hit Ctrl-C to end 12 * 13 * FIELDS: 14 * PID Process ID of Tcl 15 * UID User ID of the owner 16 * CALLS Number of calls made (proc + cmd) 17 * ARGS Process name and arguments 18 * 19 * Calls is a measure of activity, and is a count of the procedures and 20 * commands that Tcl called. 21 * 22 * The argument list is truncated at 55 characters (up to 80 is easily 23 * available). To easily read the full argument list, use other system tools; 24 * on Solaris use "pargs PID". 25 * 26 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg. 27 * 28 * CDDL HEADER START 29 * 30 * The contents of this file are subject to the terms of the 31 * Common Development and Distribution License, Version 1.0 only 32 * (the "License"). You may not use this file except in compliance 33 * with the License. 34 * 35 * You can obtain a copy of the license at Docs/cddl1.txt 36 * or http://www.opensolaris.org/os/licensing. 37 * See the License for the specific language governing permissions 38 * and limitations under the License. 39 * 40 * CDDL HEADER END 41 * 42 * 09-Sep-2007 Brendan Gregg Created this. 43 */ 44 45#pragma D option quiet 46 47dtrace:::BEGIN 48{ 49 printf("Tracing... Hit Ctrl-C to end.\n"); 50} 51 52tcl*:::proc-entry, 53tcl*:::cmd-entry 54{ 55 @calls[pid, uid, curpsinfo->pr_psargs] = count(); 56} 57 58dtrace:::END 59{ 60 printf(" %6s %6s %6s %-55s\n", "PID", "UID", "CALLS", "ARGS"); 61 printa(" %6d %6d %@6d %-55.55s\n", @calls); 62} 63