tcl_ins.d revision 1
1555N/A#!/usr/sbin/dtrace -ZCs
2362N/A/*
1555N/A * tcl_ins.d - count Tcl instructions using DTrace.
1555N/A * Written for the Tcl DTrace provider.
1555N/A *
1555N/A * $Id: tcl_ins.d 64 2007-10-04 08:35:29Z claire $
1555N/A *
1555N/A * This traces activity from all Tcl processes on the system with DTrace
1555N/A * provider support (tcl8.4.16).
1555N/A *
1555N/A * USAGE: tcl_calls.d # hit Ctrl-C to end
1555N/A *
1555N/A * FIELDS:
1555N/A * PID Process ID
1555N/A * TYPE Type of call (see below)
1555N/A * NAME Name of call
1555N/A * COUNT Number of calls during sample
1555N/A *
2362N/A * TYPEs:
2362N/A * inst instruction
2362N/A *
1555N/A * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
1555N/A *
1555N/A * CDDL HEADER START
1555N/A *
1555N/A * The contents of this file are subject to the terms of the
1555N/A * Common Development and Distribution License, Version 1.0 only
1555N/A * (the "License"). You may not use this file except in compliance
1555N/A * with the License.
1555N/A *
1555N/A * You can obtain a copy of the license at Docs/cddl1.txt
1555N/A * or http://www.opensolaris.org/os/licensing.
1555N/A * See the License for the specific language governing permissions
1555N/A * and limitations under the License.
1555N/A *
1555N/A * CDDL HEADER END
1555N/A *
1555N/A * 09-Sep-2007 Brendan Gregg Created this.
1555N/A */
1555N/A
1555N/A#pragma D option quiet
1555N/A
1555N/Adtrace:::BEGIN
1555N/A{
1555N/A printf("Tracing... Hit Ctrl-C to end.\n");
1555N/A}
1555N/A
1555N/Atcl*:::inst-start
1555N/A{
1555N/A @calls[pid, "inst", copyinstr(arg0)] = count();
1555N/A}
1555N/A
1555N/Adtrace:::END
1555N/A{
1555N/A printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
1555N/A printa(" %6d %-8s %-52s %@8d\n", @calls);
1555N/A}
1555N/A