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