#!/usr/sbin/dtrace -s #pragma D option quiet #pragma D option defaultargs #pragma D option destructive /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing * permissions and limitations under the License. * * When distributing Covered Code, include this CDDL * HEADER in each file and include the License file at * usr/src/OPENSOLARIS.LICENSE. If applicable, * add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your * own identifying information: Portions Copyright [yyyy] * [name of copyright owner] * * CDDL HEADER END * * Copyright © 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * */ /* * Usage: * memory.d -p JAVA_PID */ string memory_type[int]; :::BEGIN { memory_type[0] = "UnknownMemory"; memory_type[1] = "HeapMemory"; memory_type[2] = "ImmortalMemory"; memory_type[3] = "ScopedMemory"; system("rm vm.paused.%d", $target); } jrts$target:::memarea-change { printf("%d : Thread %d changes its current memory area to %p of type %s\n", timestamp,curthread->t_tid,arg0,memory_type[arg1]); } jrts$target:::memarea-enter { printf("%d : Thread %d enters memory area %p of type %s\n", timestamp,curthread->t_tid,arg0,memory_type[arg1]); } jrts$target:::memarea-exit { printf("%d : Thread %d exits memory area %p of type %s\n", timestamp,curthread->t_tid,arg0,memory_type[arg1]); } jrts$target:::scopedmem-creation { printf("%d : Thread %d creates ScopedMemory %d from class %s with requested size of %d and real size of %d\n", timestamp,curthread->t_tid,arg0,copyinstr(arg1,arg2),(long long)(arg3<<32)|arg4,(long long)(arg5<<32)|arg6); } jrts$target:::scopedmem-first-enter { printf("%d : Thread %d is making a first enter in scoped memory %d\n", timestamp,curthread->t_tid,arg0); } jrts$target:::scopedmem-last-exit { printf("%d : Thread %d is making a last exit from scoped memory %d\n", timestamp,curthread->t_tid,arg0); } jrts$target:::scopedmem-finalization { printf("%d : Thread %d is finalizing objects in scoped memory %d\n", timestamp,curthread->t_tid,arg0); }