3 * j_objnew.d - report Java object allocation using DTrace.
4 * Written for the Java hotspot DTrace provider.
6 * $Id: j_objnew.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_objnew.d # hit Ctrl-C to end
16 * OBJS Number of objects created
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*:::object-alloc
47 this->class = (char *)copyin(arg1, arg2 + 1);
48 this->class[arg2] = '\0';
49 @objs[pid, stringof(this->class)] = count();
50 @dist[pid, stringof(this->class)] = quantize(arg3);
55 printf("Java object allocation byte distributions by pid and class,\n");
58 printf("Java object allocation count by pid and class,\n\n");
59 printf(" %6s %8s %s\n", "PID", "OBJS", "CLASS");
60 printa(" %6d %8@d %s\n", @objs);