#!/usr/sbin/dtrace -s #pragma D option quiet #pragma D option defaultargs #pragma D option destructive /* * 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); }