JETM Basic concepts
Consider a Java™ application that has or potentially may have performance problems. What do you do?
Most likely you will go ahead and profile the application using a Java Profiler or just log execution times to a logging framework. Both strategies will hopefully give you enough information to understand what is really going wrong in your application.
However these two strategies do have their drawbacks.
Even though a Java™ Profiler offers a detailed inside-view to your application you sometimes just can't use it. This is because typically a profiler makes use of the Java™ Virtual Machine Profiling Interface (JVMPI) or Java™ Virtual Machine Tool Interface (JVMTI) to collect fine-grained details such as object and memory allocations, execution paths and garbage collector behavior. The usage of these interfaces and the related profiler extensions usually add some overhead to executions times and thus may slow down an application to a point where it is impossible to be used in a production environment.
As an alternative to profiling and often as part of the runtime monitoring process application developers tend to log execution times to log files. Depending on the size of the application and the developer team this tends to be a major nightmare in terms data formatting, quality and consistency.
While leaving the in-depth application performance analysis in the hands of professional Java Profilers there is often a need to monitor an application under production load or even transparently during development and testing. Therefore it is necessary to provide means to collect statistics similar to the ones of Java Profilers without their side effects. From a high level perspective JETM gives you exactly this ability with minimal (but existing) impact on application performance and minimal requirements for test setup and maintenance.
How does it work?
All you need to do is to mark code fragments as to be measured and associate a name with it. These so called EtmPoints or MeasurementPoints are the foundation of the Java™ Execution Time Measurement Library.