3 * js_flow.d - snoop JavaScript execution showing function flow using DTrace.
4 * Written for the JavaScript DTrace provider.
6 * $Id: js_flow.d 63 2007-10-04 04:34:38Z brendan $
8 * This traces activity from all browsers on the system that are running
9 * with JavaScript provider support.
11 * USAGE: js_flow.d # hit Ctrl-C to end
15 * TIME(us) Time since boot, us
16 * FILE Filename that this function belongs to
23 * Filename and function names are printed if available.
25 * WARNING: Watch the first column carefully, it prints the CPU-id. If it
26 * changes, then it is very likely that the output has been shuffled.
28 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
32 * The contents of this file are subject to the terms of the
33 * Common Development and Distribution License, Version 1.0 only
34 * (the "License"). You may not use this file except in compliance
37 * You can obtain a copy of the license at Docs/cddl1.txt
38 * or http://www.opensolaris.org/os/licensing.
39 * See the License for the specific language governing permissions
40 * and limitations under the License.
44 * 09-Sep-2007 Brendan Gregg Created this.
47 #pragma D option quiet
48 #pragma D option switchrate=10
54 printf("%3s %-16s %-22s -- %s\n", "C", "TIME(us)", "FILE", "FUNC");
57 javascript*:::function-entry
59 printf("%3d %-16d %-22s %*s-> %s\n", cpu, timestamp / 1000,
60 basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg2));
64 javascript*:::function-return
66 self->depth -= self->depth > 0 ? 1 : 0;
67 printf("%3d %-16d %-22s %*s<- %s\n", cpu, timestamp / 1000,
68 basename(copyinstr(arg0)), self->depth * 2, "", copyinstr(arg2));