JEP 520: JFR Method Timing & Tracing

RUN :

scripts/jep520/trace-method.sh

It is tracing specific method :

results :

During development, we already have good tools for analyzing method execution: The Java Microbenchmark Harnessarrow-up-right (JMH) can measure method execution times, and debuggers built on top of the Java Debug Interfacearrow-up-right (JDI) can set breakpoints and inspect call stacks.

During testing and production, however, timing and tracing pose challenges. There are several approaches, none fully satisfactory:

  • logs

  • java agents

  • not accurate sample based profilers

More about disadvantages on jep page Also from jep page :

We introduce two new JFR events, jdk.MethodTiming and jdk.MethodTrace. They both accept a filter to select the methods to time and trace.

For example, to see what triggers the resize of a HashMap, you can configure the MethodTrace event's filter when making a recording and then use the jfr toolarrow-up-right to display the recorded event:

Last updated