Develop with pleasure!

福岡でCloudとかBlockchainとか。

BTrace

カーネルの動作をトレースするDTraceは知ってたけど、Javaでもバイトコードの動作をトレースできるBTraceというのがあるのね。

BTrace is a safe, dynamic tracing tool for the Java platform. BTrace can be used to dynamically trace a running Java program (similar to DTrace for OpenSolaris applications and OS). BTrace dynamically instruments the classes of the target application to inject tracing code ("bytecode tracing"). Tracing code is expressed in Java programming language. There is also integration with DTrace for the OpenSolaris platform.

https://btrace.dev.java.net/

DTraceがD言語を使用して記述しないといけないのに比べて、BTraceの場合はJavaで記述できるので敷居が低いのが良い。まぁBTraceの場合はJavaバイトコードのみしかトレースはできないという点でDTraceとはスコープが異なるけど。使用できるのはJava6からみたいなので、JavaのEOLも考慮すると今後はJava6への移行が望ましいんだろうなぁ。

最近はVisualVMのリリースとか含めて、こういったプロファイリングツールの充実もしてる。全てはVMの上で!