3 * js_flowtime.d - JavaScript function flow with delta times using DTrace.
4 * Written for the JavaScript DTrace provider.
6 * $Id: js_flowtime.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_flowtime.d # hit Ctrl-C to end
15 * TIME(us) Time since boot, us
16 * FILE Filename that this function belongs to
17 * DELTA(us) Elapsed time from previous line to this line
24 * Filename and function names are printed if available.
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 %-18s %9s -- %s\n", "C", "TIME(us)", "FILE",
59 javascript*:::function-entry,
60 javascript*:::function-return
63 self->last = timestamp;
66 javascript*:::function-entry
68 this->delta = (timestamp - self->last) / 1000;
69 printf("%3d %-16d %-18s %9d %*s-> %s\n", cpu, timestamp / 1000,
70 basename(copyinstr(arg0)), this->delta, self->depth * 2, "",
73 self->last = timestamp;
76 javascript*:::function-return
78 this->delta = (timestamp - self->last) / 1000;
79 self->depth -= self->depth > 0 ? 1 : 0;
80 printf("%3d %-16d %-18s %9d %*s<- %s\n", cpu, timestamp / 1000,
81 basename(copyinstr(arg0)), this->delta, self->depth * 2, "",
83 self->last = timestamp;