3 * j_stat.d - Java operation stats using DTrace.
4 * Written for the Java hotspot DTrace provider.
6 * $Id: j_stat.d 64 2007-10-04 08:35:29Z claire $
8 * This traces activity from all Java processes on the system with hotspot
9 * provider support (1.6.0). Method calls and object allocation are only
10 * visible when using the flag "+ExtendedDTraceProbes". eg,
11 * java -XX:+ExtendedDTraceProbes classfile
13 * USAGE: j_stat.d [interval [count]]
16 * EXEC/s Java programs executed per second, including
17 * those without Java provider support
18 * THREAD/s Threads created, per second
19 * METHOD/s Methods called, per second
20 * OBJNEW/s Objects created, per second
21 * CLOAD/s Class loads, per second
22 * EXCP/s Exceptions raised, per second
23 * GC/s Garbage collects, per second
25 * The numbers are per second counts for the interval specified. The default
26 * interval is 1 second.
28 * If you see a count in "EXECS" but not in the other columns, then your
29 * Java software is probably not running with the DTrace hotspot provider.
31 * If you see counts in "CLOAD" but not in "METHODS", then you Java
32 * software probably isn't running with "+ExtendedDTraceProbes".
34 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
38 * The contents of this file are subject to the terms of the
39 * Common Development and Distribution License, Version 1.0 only
40 * (the "License"). You may not use this file except in compliance
43 * You can obtain a copy of the license at Docs/cddl1.txt
44 * or http://www.opensolaris.org/os/licensing.
45 * See the License for the specific language governing permissions
46 * and limitations under the License.
50 * 09-Sep-2007 Brendan Gregg Created this.
53 #pragma D option quiet
54 #pragma D option defaultargs
56 inline int SCREEN = 21;
60 execs = threads = methods = objnew = cload = gc = exception = 0;
62 interval = $1 ? $1 : 1;
63 counts = $2 ? $2 : -1;
78 /first || (secs == 0 && lines > SCREEN)/
80 printf("%-20s %6s %8s %8s %8s %8s %6s %6s\n", "TIME", "EXEC/s",
81 "THREAD/s", "METHOD/s", "OBJNEW/s", "CLOAD/s", "EXCP/s", "GC/s");
95 hotspot*:::thread-start
100 hotspot*:::method-entry
105 hotspot*:::object-alloc
110 hotspot*:::class-loaded
120 hotspot*:::ExceptionOccurred-entry
131 printf("%-20Y %6d %8d %8d %8d %8d %6d %6d\n", walltimestamp,
132 execs / interval, threads / interval, methods / interval,
133 oalloc / interval, cload / interval, exception / interval,
135 execs = threads = methods = oalloc = cload = gc = exception = 0;