3 * j_methodcalls.d - count Java method calls DTrace.
4 * Written for the Java hotspot DTrace provider.
6 * $Id: j_methodcalls.d 19 2007-09-12 07:47:59Z brendan $
8 * This traces activity from all Java processes on the system with hotspot
9 * provider support (1.6.0) and the flag "+ExtendedDTraceProbes". eg,
10 * java -XX:+ExtendedDTraceProbes classfile
12 * USAGE: j_methodcalls.d # hit Ctrl-C to end
16 * COUNT Number of calls during sample
17 * CLASS.METHOD Java class and method name
19 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
23 * The contents of this file are subject to the terms of the
24 * Common Development and Distribution License, Version 1.0 only
25 * (the "License"). You may not use this file except in compliance
28 * You can obtain a copy of the license at Docs/cddl1.txt
29 * or http://www.opensolaris.org/os/licensing.
30 * See the License for the specific language governing permissions
31 * and limitations under the License.
35 * 09-Sep-2007 Brendan Gregg Created this.
38 #pragma D option quiet
42 printf("Tracing... Hit Ctrl-C to end.\n");
45 hotspot*:::method-entry
47 this->class = (char *)copyin(arg1, arg2 + 1);
48 this->class[arg2] = '\0';
49 this->method = (char *)copyin(arg3, arg4 + 1);
50 this->method[arg4] = '\0';
51 this->name = strjoin(strjoin(stringof(this->class), "."),
52 stringof(this->method));
53 @calls[pid, this->name] = count();
58 printf(" %6s %8s %s\n", "PID", "COUNT", "CLASS.METHOD");
59 printa(" %6d %@8d %s\n", @calls);