3 * rb_stat.d - Ruby operation stats using DTrace.
4 * Written for the Ruby DTrace provider.
6 * $Id: rb_stat.d 20 2007-09-12 09:28:22Z brendan $
8 * This traces activity from all Ruby programs on the system that are
9 * running with Ruby provider support.
11 * USAGE: rb_stat.d [interval [count]]
14 * EXEC/s Ruby programs executed per second, including
15 * those without Ruby provider support
16 * METHOD/s Methods called, per second
17 * OBJNEW/s Objects created, per second
18 * OBJFRE/s Objects freed, per second
19 * RAIS/s Raises, per second
20 * RESC/s Rescues, per second
21 * GC/s Garbage collects, per second
23 * The numbers are counts for the interval specified. The default interval
26 * If you see a count in "EXECS" but not in the other columns, then your
27 * Ruby software is probably not running with the DTrace Ruby provider.
30 * Filename and method names are printed if available.
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 defaultargs
54 inline int SCREEN = 21;
58 execs = methods = objnew = objfree = gc = raised = rescue = 0;
60 interval = $1 ? $1 : 1;
61 counts = $2 ? $2 : -1;
76 /first || (secs == 0 && lines > SCREEN)/
78 printf("%-20s %8s %8s %8s %8s %6s %6s %6s\n", "TIME", "EXEC/s",
79 "METHOD/s", "OBJNEW/s", "OBJFRE/s", "RAIS/s", "RESC/s", "GC/s");
93 ruby*:::function-entry
98 ruby*:::object-create-start
129 printf("%-20Y %8d %8d %8d %8d %6d %6d %6d\n", walltimestamp,
130 execs / interval, methods / interval, objnew / interval,
131 objfree / interval, raised / interval, rescue / interval,
133 execs = methods = objnew = objfree = gc = raised = rescue = 0;