1#!/usr/sbin/dtrace -Zs 2/* 3 * j_events.d - count Java events using DTrace. 4 * Written for the Java hotspot DTrace provider. 5 * 6 * $Id: j_events.d,v 1.1.1.1 2015/09/30 22:01:09 christos Exp $ 7 * 8 * This traces activity from all Java processes on the system with hotspot 9 * provider support (1.6.0). Some events such as method calls are only 10 * visible when using the flag "+ExtendedDTraceProbes". eg, 11 * java -XX:+ExtendedDTraceProbes classfile 12 * 13 * USAGE: j_events.d # hit Ctrl-C to end 14 * 15 * FIELDS: 16 * PID Process ID 17 * EVENT Event name (DTrace probe name) 18 * COUNT Number of calls during sample 19 * 20 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg. 21 * 22 * CDDL HEADER START 23 * 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 27 * with the License. 28 * 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. 33 * 34 * CDDL HEADER END 35 * 36 * 09-Sep-2007 Brendan Gregg Created this. 37 */ 38 39#pragma D option quiet 40 41dtrace:::BEGIN 42{ 43 printf("Tracing... Hit Ctrl-C to end.\n"); 44} 45 46/* this matches both hotspot and hotspot_jni providers */ 47hotspot*::: 48{ 49 @calls[pid, probename] = count(); 50} 51 52dtrace:::END 53{ 54 printf(" %6s %-36s %8s\n", "PID", "EVENT", "COUNT"); 55 printa(" %6d %-36s %@8d\n", @calls); 56} 57