Existing profilers for Java applications typically rely on custom instrumentation in the Java virtual machine, and measure only limited types of resource consumption. Garbage collection and multi-threading pose additional challenges to profiler design and implementation.
In this paper we discuss a general-purpose, portable, and extensible
approach for obtaining comprehensive profiling information from the Java
virtual machine. Profilers based on this framework can uncover CPU
usage hot spots, heavy memory allocation sites, unnecessary object
retention, contended monitors, and thread deadlocks. In addition, we
discuss a novel algorithm for thread-aware statistical CPU time
profiling, a heap profiling technique independent of the garbage
collection implementation, and support for interactive profiling
with minimum overhead.