3 * pl_flow.d - snoop Perl execution showing subroutine flow.
4 * Written for the Solaris Perl DTrace provider.
6 * $Id: pl_flow.d 41 2007-09-17 02:20:10Z brendan $
8 * This traces Perl activity from all Perl programs on the system
9 * running with Perl provider support.
11 * USAGE: pl_flow.d # hit Ctrl-C to end
13 * This watches Perl subroutine entries and returns, and indents child
18 * TIME(us) Time since boot, us
19 * FILE Filename that this subroutine belongs to
24 * <- subroutine return
26 * WARNING: Watch the first column carefully, it prints the CPU-id. If it
27 * changes, then it is very likely that the output has been shuffled.
29 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
33 * The contents of this file are subject to the terms of the
34 * Common Development and Distribution License, Version 1.0 only
35 * (the "License"). You may not use this file except in compliance
38 * You can obtain a copy of the license at Docs/cddl1.txt
39 * or http://www.opensolaris.org/os/licensing.
40 * See the License for the specific language governing permissions
41 * and limitations under the License.
45 * 09-Sep-2007 Brendan Gregg Created this.
48 #pragma D option quiet
49 #pragma D option switchrate=10
55 printf("%3s %-16s %-16s -- %s\n", "C", "TIME(us)", "FILE", "SUB");
60 printf("%3d %-16d %-16s %*s-> %s\n", cpu, timestamp / 1000,
61 basename(copyinstr(arg1)), self->depth * 2, "", copyinstr(arg0));
67 self->depth -= self->depth > 0 ? 1 : 0;
68 printf("%3d %-16d %-16s %*s<- %s\n", cpu, timestamp / 1000,
69 basename(copyinstr(arg1)), self->depth * 2, "", copyinstr(arg0));