开发者

Profiling vs Instrumentation - Java

开发者 https://www.devze.com 2023-03-12 22:03 出处:网络
Basic question: JVM provides JVMTI which native API for profiling and debugging JVM. JVM instrumentation also does the same (is that correct?). If yes, w开发者_开发百科hat is difference between the bo

Basic question: JVM provides JVMTI which native API for profiling and debugging JVM. JVM instrumentation also does the same (is that correct?). If yes, w开发者_开发百科hat is difference between the both?


I dont think that Instrumentation is JVMTI is Superset of Instrumentation.. as Both of these can be used independently.

JVMTI is based on events and in the event handlers we can capture required information about the JVM.

Instrumentation is Something in which we modify the Bytecode and hence in turn add extra piece of code at runtime at required location in the class before it loads in the JVM. this extra piece of code when executed, will help gather required information for the profiler.

Instrumentation can be achieved with the help of various third party jar's like ASM.

As per my knowledge and experience Both of these are for Java profiling and not for Native profiling.

Probably need to read more documents and tryout different samples for better understanding.


JVMTI gives all the functionality the debugger needs, however if you want to more than what the JVMTI provides you need to use Instrumentation.


JVMTI is base functionality that provides all sorts of events for debugging, profiling, etc... One of the areas it provides is access to intercept (and redefine) classes. java.lang.instrument is a Java wrapper on top of JVMTI that provides a nice, easy, accessible way of getting at the class loading events.

Think of JVMTI as a pure superset of java.lang.instrument, but requires the user to write C code.

0

精彩评论

暂无评论...
验证码 换一张
取 消