Steve Jenson's blog

DTrace for Java 6 on Leopard

DTrace for Java 6 on Leopard

When Java 6 for Leopard was released a few weeks ago, one thing that nobody seemed to notice was that Java now had DTrace probes on par with Java on Solaris.

What you expect is there:

With one exception: jstack doesn't appear to work. ustack works fine.

    
    $ sudo dtrace -x jstackstrsize=2048 -n 'syscall::read:entry /execname == "java"/ { jstack(); }' 

    dtrace: description 'syscall::read:entry ' matched 1 probe
    CPU     ID                    FUNCTION:NAME
    3  17600                       read:entry 

    2  17600                       read:entry 

    3  17600                       read:entry 

    3  17600                       read:entry 

    2  17600                       read:entry 

    2  17600                       read:entry 

    2  17600                       read:entry 

    2  17600                       read:entry
    
    

There should be java stack traces under each read:entry line. (This is true even with -XX:+ExtendedDTraceProbes enabled)

I used robey's scarling for my guinea pig and had a lot of fun poking around at it with dtrace.

# — 19 May, 2008