The following are examples of running the j_calls.d script.
This traces activity from all Java processes on the system with hotspot
provider support (1.6.0). Method calls and object allocation are only visible
when using the flag "+ExtendedDTraceProbes". eg,
java -XX:+ExtendedDTraceProbes classfile
Here we see it running on Code/Java/Func_abc
# j_calls.d
Tracing... Hit Ctrl-C to end.
^C
PID TYPE NAME COUNT
311334 cload Func_abc 1
311334 cload java/io/BufferedInputStream 1
311334 cload java/io/BufferedOutputStream 1
311334 cload java/io/BufferedReader 1
311334 cload java/io/BufferedWriter 1
311334 cload java/io/Closeable 1
311334 cload java/io/Console 1
311334 cload java/io/Console$1 1
311334 cload java/io/Console$1$1 1
311334 cload java/io/DataInput 1
311334 cload java/io/DataInputStream 1
311334 cload java/io/DeleteOnExitHook 1
311334 cload java/io/ExpiringCache 1
311334 cload java/io/ExpiringCache$1 1
311334 cload java/io/ExpiringCache$Entry 1
311334 cload java/io/File 1
311334 cload java/io/File$1 1
311334 cload java/io/FileDescriptor 1
311334 cload java/io/FileInputStream 1
311334 cload java/io/FileOutputStream 1
311334 cload java/io/FilePermission 1
311334 cload java/io/FilePermission$1 1
311334 cload java/io/FilePermissionCollection 1
311334 cload java/io/FileReader 1
311334 cload java/io/FileSystem 1
311334 cload java/io/FilterInputStream 1
311334 cload java/io/FilterOutputStream 1
311334 cload java/io/Flushable 1
311334 cload java/io/InputStream 1
311334 cload java/io/InputStreamReader 1
311334 cload java/io/ObjectStreamClass 1
311334 cload java/io/ObjectStreamField 1
311334 cload java/io/OutputStream 1
311334 cload java/io/OutputStreamWriter 1
311334 cload java/io/PrintStream 1
311334 cload java/io/Reader 1
311334 cload java/io/Serializable 1
311334 cload java/io/UnixFileSystem 1
311334 cload java/io/Writer 1
311334 cload java/lang/AbstractStringBuilder 1
311334 cload java/lang/Appendable 1
311334 cload java/lang/ApplicationShutdownHooks 1
311334 cload java/lang/ArithmeticException 1
311334 cload java/lang/ArrayStoreException 1
311334 cload java/lang/Boolean 1
311334 cload java/lang/Byte 1
311334 cload java/lang/CharSequence 1
311334 cload java/lang/Character 1
311334 cload java/lang/CharacterDataLatin1 1
311334 cload java/lang/Class 1
[... 1400 lines truncated ...]
311334 method java/lang/Class.getClassLoader0 34
311334 method java/lang/String.toLowerCase 34
311334 method sun/security/action/GetPropertyAction.run 34
311334 method java/nio/CharBuffer.arrayOffset 36
311334 method java/util/HashMap.getEntry 36
311334 method java/io/File.<init> 37
311334 method java/io/UnixFileSystem.prefixLength 37
311334 oalloc java/io/File 37
311334 oalloc java/lang/reflect/Field 37
311334 method java/io/BufferedReader.readLine 38
311334 method java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread 38
311334 method java/lang/CharacterDataLatin1.toLowerCase 41
311334 method java/lang/CharacterDataLatin1.getProperties 43
311334 method java/security/AccessController.doPrivileged 43
311334 method java/util/Vector.size 43
311334 method java/nio/Buffer.position 44
311334 method java/nio/ByteBuffer.arrayOffset 44
311334 method java/lang/System.getProperty 48
311334 method java/util/Properties.getProperty 50
311334 method java/util/BitSet.expandTo 51
311334 method java/util/BitSet.set 51
311334 method java/lang/System.checkKey 56
311334 method java/lang/Thread.currentThread 57
311334 method java/util/Hashtable$Entry.<init> 57
311334 oalloc [Ljava/lang/String; 57
311334 oalloc java/util/Hashtable$Entry 57
311334 method java/util/Hashtable.get 59
311334 method java/util/Hashtable.put 63
311334 method java/util/BitSet.checkInvariants 71
311334 method java/util/BitSet.wordIndex 72
311334 method java/lang/StringBuilder.<init> 73
311334 method java/lang/StringBuilder.toString 73
311334 oalloc java/lang/StringBuilder 73
311334 method java/lang/AbstractStringBuilder.expandCapacity 81
311334 method java/util/HashMap.hash 81
311334 method java/util/HashMap.indexFor 81
311334 method java/lang/AbstractStringBuilder.<init> 82
311334 method java/lang/Character.toLowerCase 82
311334 method java/lang/String.startsWith 83
311334 method java/util/Arrays.copyOf 87
311334 method java/lang/String.lastIndexOf 90
311334 method java/lang/String.substring 94
311334 method java/util/Arrays.copyOfRange 107
311334 method java/lang/String.getChars 156
311334 method java/lang/System.getSecurityManager 174
311334 method java/lang/String.<init> 175
311334 method java/lang/String.equals 202
311334 method java/lang/Math.min 208
311334 method java/lang/String.hashCode 213
311334 method java/lang/String.indexOf 302
311334 oalloc [Ljava/lang/Object; 326
311334 method java/lang/System.arraycopy 360
311334 oalloc [I 374
311334 oalloc java/lang/Class 395
311334 oalloc [B 406
311334 oalloc [S 486
311334 method java/lang/StringBuilder.append 533
311334 oalloc [[I 541
311334 method java/lang/AbstractStringBuilder.append 549
311334 method java/lang/Object.<init> 823
311334 oalloc java/lang/String 931
311334 oalloc [C 1076
311334 method java/lang/String.charAt 1960
This shows us each of the events associated with the PID 311334, and the
number of times each event happened. These events can be of type cload (class
load), method (method call), mcompile (method compile), mload (compiled method
load), oalloc (object alloc) or thread (thread start).
In this case you can see 1960 calls to java/lang/String.charAt, and 1076
object allocations of type [C.