py_funccalls.d revision 1
2N/A#!/usr/sbin/dtrace -Zs
2N/A/*
2N/A * py_funccalls.d - measure Python function calls using DTrace.
2N/A * Written for the Python DTrace provider.
2N/A *
2N/A * $Id: py_funccalls.d 25 2007-09-12 09:51:58Z brendan $
2N/A *
2N/A * This traces Python activity from all running programs on the system
2N/A * which support the Python DTrace provider.
2N/A *
2N/A * USAGE: py_funccalls.d # hit Ctrl-C to end
2N/A *
2N/A * FIELDS:
2N/A * FILE Filename that contained the function
2N/A * FUNC Python function name
2N/A * CALLS Function calls during this sample
2N/A *
2N/A * Filename and function names are printed if available.
2N/A *
2N/A * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
2N/A *
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at Docs/cddl1.txt
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * CDDL HEADER END
2N/A *
2N/A * 09-Sep-2007 Brendan Gregg Created this.
2N/A */
2N/A
2N/A#pragma D option quiet
2N/A
2N/Adtrace:::BEGIN
2N/A{
2N/A printf("Tracing... Hit Ctrl-C to end.\n");
2N/A}
2N/A
2N/Apython*:::function-entry
2N/A{
2N/A @funcs[basename(copyinstr(arg0)), copyinstr(arg1)] = count();
2N/A}
2N/A
2N/Adtrace:::END
2N/A{
2N/A printf(" %-32s %-32s %8s\n", "FILE", "FUNC", "CALLS");
2N/A printa(" %-32s %-32s %@8d\n", @funcs);
2N/A}
2N/A