3 * php_syscalls.d - count PHP function calls and syscalls using DTrace.
4 * Written for the PHP DTrace provider.
6 * This traces syscalls that occured during a PHP function call.
8 * $Id: php_syscalls.d 53 2007-09-24 04:58:38Z brendan $
10 * USAGE: php_syscalls.d # hit Ctrl-C to end
14 * FILE Filename of the PHP program
15 * TYPE Type of call (func/syscall)
17 * COUNT Number of calls during sample
19 * Filename and function names are printed if available.
20 * The filename for syscalls may be printed as "php", if the program
21 * was invoked using the form "php filename" rather than running the
22 * program with an interpreter line.
24 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
28 * The contents of this file are subject to the terms of the
29 * Common Development and Distribution License, Version 1.0 only
30 * (the "License"). You may not use this file except in compliance
33 * You can obtain a copy of the license at Docs/cddl1.txt
34 * or http://www.opensolaris.org/os/licensing.
35 * See the License for the specific language governing permissions
36 * and limitations under the License.
40 * 09-Sep-2007 Brendan Gregg Created this.
43 #pragma D option quiet
47 printf("Tracing... Hit Ctrl-C to end.\n");
53 @calls[pid, basename(copyinstr(arg1)), "func", copyinstr(arg0)] =
58 php*:::function-return
61 self->php -= self->php == 0 ? 0 : 1;
67 @calls[pid, basename(execname), "syscall", probefunc] = count();
72 printf(" %-6s %-26s %-10s %-22s %8s\n", "PID", "FILE", "TYPE", "NAME",
74 printa(" %-6d %-26s %-10s %-22s %@8d\n", @calls);