j_who.d revision 235380
1#!/usr/sbin/dtrace -Zs 2/* 3 * j_who.d - trace Java calls by process using DTrace. 4 * Written for the Java hotspot DTrace provider. 5 * 6 * $Id: j_who.d 19 2007-09-12 07:47:59Z brendan $ 7 * 8 * This traces activity from all Java processes on the system with hotspot 9 * provider support (1.6.0). 10 * 11 * USAGE: j_who.d # hit Ctrl-C to end 12 * 13 * FIELDS: 14 * PID Process ID of Java 15 * UID User ID of the owner 16 * CALLS Number of calls made (a measure of activity) 17 * ARGS Process name and arguments 18 * 19 * The argument list is truncated at 55 characters (up to 80 is easily 20 * available). To easily read the full argument list, use other system tools; 21 * on Solaris use "pargs PID". 22 * 23 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg. 24 * 25 * CDDL HEADER START 26 * 27 * The contents of this file are subject to the terms of the 28 * Common Development and Distribution License, Version 1.0 only 29 * (the "License"). You may not use this file except in compliance 30 * with the License. 31 * 32 * You can obtain a copy of the license at Docs/cddl1.txt 33 * or http://www.opensolaris.org/os/licensing. 34 * See the License for the specific language governing permissions 35 * and limitations under the License. 36 * 37 * CDDL HEADER END 38 * 39 * 09-Sep-2007 Brendan Gregg Created this. 40 */ 41 42#pragma D option quiet 43 44dtrace:::BEGIN 45{ 46 printf("Tracing... Hit Ctrl-C to end.\n"); 47} 48 49hotspot*:::Call*-entry 50{ 51 @calls[pid, uid, curpsinfo->pr_psargs] = count(); 52} 53 54dtrace:::END 55{ 56 printf(" %6s %6s %6s %-55s\n", "PID", "UID", "CALLS", "ARGS"); 57 printa(" %6d %6d %@6d %-55.55s\n", @calls); 58} 59