3 * js_stat.d - JavaScript operation stats using DTrace.
4 * Written for the JavaScript DTrace provider.
6 * $Id: js_stat.d 63 2007-10-04 04:34:38Z brendan $
8 * This traces activity from all browsers on the system that are
9 * running with JavaScript provider support.
11 * USAGE: js_stat.d [interval [count]]
14 * EXEC/s JavaScript programs executed per second
15 * FUNCS/s Functions called, per second
16 * OBJNEW/s Objects created, per second
17 * OBJFRE/s Objects freed (finalize), per second
19 * The numbers are counts for the interval specified. The default interval
22 * Filename and function names are printed if available.
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
44 #pragma D option defaultargs
46 inline int SCREEN = 21;
50 execs = funcs = objnew = objfree = 0;
52 interval = $1 ? $1 : 1;
53 counts = $2 ? $2 : -1;
68 /first || (secs == 0 && lines > SCREEN)/
70 printf("%-20s %8s %8s %8s %8s\n", "TIME", "EXEC/s", "FUNC/s",
71 "OBJNEW/s", "OBJFRE/s");
79 javascript*:::execute-start
84 javascript*:::function-entry
89 javascript*:::object-create-start
94 javascript*:::object-finalize
105 printf("%-20Y %8d %8d %8d %8d\n", walltimestamp, execs / interval,
106 funcs / interval, objnew / interval, objfree / interval);
107 execs = funcs = objnew = objfree = 0;