php_who.d revision 235368
1#!/usr/sbin/dtrace -Zs 2/* 3 * php_who.d - trace PHP function execution by process using DTrace. 4 * Written for the PHP DTrace provider. 5 * 6 * $Id: php_who.d 51 2007-09-24 00:55:23Z brendan $ 7 * 8 * This traces PHP activity from all PHP programs on the system that are 9 * running with PHP provider support. 10 * 11 * USAGE: php_who.d # hit Ctrl-C to end 12 * 13 * FIELDS: 14 * PID Process ID of PHP 15 * UID User ID of the owner 16 * FUNCS Number of function calls 17 * FILE Pathname of the PHP program 18 * 19 * Filenames are printed if available. 20 * 21 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg. 22 * 23 * CDDL HEADER START 24 * 25 * The contents of this file are subject to the terms of the 26 * Common Development and Distribution License, Version 1.0 only 27 * (the "License"). You may not use this file except in compliance 28 * with the License. 29 * 30 * You can obtain a copy of the license at Docs/cddl1.txt 31 * or http://www.opensolaris.org/os/licensing. 32 * See the License for the specific language governing permissions 33 * and limitations under the License. 34 * 35 * CDDL HEADER END 36 * 37 * 09-Sep-2007 Brendan Gregg Created this. 38 */ 39 40#pragma D option quiet 41 42dtrace:::BEGIN 43{ 44 printf("Tracing... Hit Ctrl-C to end.\n"); 45} 46 47php*:::function-entry 48{ 49 @lines[pid, uid, copyinstr(arg1)] = count(); 50} 51 52dtrace:::END 53{ 54 printf(" %6s %6s %6s %s\n", "PID", "UID", "FUNCS", "FILE"); 55 printa(" %6d %6d %@6d %s\n", @lines); 56} 57