3 * j_syscalls.d - count Java methods and syscalls using DTrace.
4 * Written for the Java hotspot DTrace provider.
6 * $Id: j_syscalls.d 19 2007-09-12 07:47:59Z brendan $
8 * This traces Java methods if the hotspot provider exists (1.6.0) and
9 * the flag "+ExtendedDTraceProbes" is used. eg,
10 * java -XX:+ExtendedDTraceProbes classfile
12 * USAGE: j_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end
16 * TYPE Type of call (method/syscall)
18 * COUNT Number of calls during sample
20 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
24 * The contents of this file are subject to the terms of the
25 * Common Development and Distribution License, Version 1.0 only
26 * (the "License"). You may not use this file except in compliance
29 * You can obtain a copy of the license at Docs/cddl1.txt
30 * or http://www.opensolaris.org/os/licensing.
31 * See the License for the specific language governing permissions
32 * and limitations under the License.
36 * 09-Sep-2007 Brendan Gregg Created this.
39 #pragma D option quiet
43 printf("Tracing... Hit Ctrl-C to end.\n");
46 hotspot$target:::method-entry
48 this->class = (char *)copyin(arg1, arg2 + 1);
49 this->class[arg2] = '\0';
50 this->method = (char *)copyin(arg3, arg4 + 1);
51 this->method[arg4] = '\0';
52 this->name = strjoin(strjoin(stringof(this->class), "."),
53 stringof(this->method));
54 @calls[pid, "method", this->name] = count();
60 @calls[pid, "syscall", probefunc] = count();
66 printf(" %6s %-8s %-52s %8s\n", "PID", "TYPE", "NAME", "COUNT");
67 printa(" %6d %-8s %-52s %@8d\n", @calls);