3 * php_flowtime.d - snoop PHP functions with flow and delta times.
4 * Written for the PHP DTrace provider.
6 * $Id: php_flowtime.d 53 2007-09-24 04:58:38Z brendan $
8 * This traces shell activity from PHP programs on the system that are
9 * running with PHP provider support.
11 * USAGE: php_flowtime.d # hit Ctrl-C to end
13 * This watches PHP function entries and returns, and indents child
18 * TIME(us) Time since boot, us
19 * FILE Filename that this function belongs to
20 * DELTA(us) Elapsed time from previous line to this line
21 * FUNC PHP function name
27 * Filename and function names are printed if available.
29 * WARNING: Watch the first column carefully, it prints the CPU-id. If it
30 * changes, then it is very likely that the output has been shuffled.
32 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
36 * The contents of this file are subject to the terms of the
37 * Common Development and Distribution License, Version 1.0 only
38 * (the "License"). You may not use this file except in compliance
41 * You can obtain a copy of the license at Docs/cddl1.txt
42 * or http://www.opensolaris.org/os/licensing.
43 * See the License for the specific language governing permissions
44 * and limitations under the License.
48 * 09-Sep-2007 Brendan Gregg Created this.
51 #pragma D option quiet
52 #pragma D option switchrate=10
60 printf("%3s %-16s %-16s %9s -- %s\n", "C", "TIME(us)", "FILE",
64 php*:::function-entry,
65 php*:::function-return
68 self->last = timestamp;
74 this->delta = (timestamp - self->last) / 1000;
75 printf("%3d %-16d %-16s %9d %*s-> %s\n", cpu, timestamp / 1000,
76 basename(copyinstr(arg1)), this->delta, self->depth * 2, "",
79 self->last = timestamp;
82 php*:::function-return
85 this->delta = (timestamp - self->last) / 1000;
86 self->depth -= self->depth > 0 ? 1 : 0;
87 printf("%3d %-16d %-16s %9d %*s<- %s\n", cpu, timestamp / 1000,
88 basename(copyinstr(arg1)), this->delta, self->depth * 2, "",
90 self->last = timestamp;