JSamp: A sampling profiler for Java

about | archive

[ 2008-September-15 21:19 ]

When investigating performance issues, profilers are the first tool I use. When working with C++ on Linux, I use Google's C++ profiler. Recently, I've been working on a Java project where performance was an important priority. While VisualVM and HProf are both useful tools, they both have important limitations. VisualVM is an instrumenting profiler, which means that when running a program with it, the program becomes significantly slower. Worse, since it instruments every method call, tiny methods which are normally very cheap will become expensive. Hence, I don't trust the results. HProf is a sampling profiler, which impacts the performance less and produces more realistic results. However, it starts profiling at the beginning of the Java program, and finishes at the end. This was inappropriate for my application, which has large start up overhead. Hence, I wrote JSamp, with help from my co-worker (co-student?) Yang Zhang.

JSamp is a sampling profiler for Java. It is written completely in Java, which should mean it is portable. It uses the Attach API to attach to an existing JVM. While it has many limitations, it has been useful for me. See the JSamp Google Code project page for source and documentation.