I am trying to selectively control / profile a Java application when certain execution conditions are met. I can already drop the heap on the fly using HotSpotDiagnosticMXBean , which was quite useful.
Now I'm trying to do something similar with CPU profiling, hoping to target specific code codes more efficiently. I have experience with the HPROF interface and the NetBeans profiler, but both must be started in advance.
Is there a way to activate the HPROF profiler programmatically from a running application? Preferably, something that would allow me to start and stop the profiling process at will?
java profiler hprof
thkala
source share