Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8046157

JEP 167: Event-Based JVM Tracing


    • Type: JEP
    • Status: Closed
    • Priority: P4
    • Resolution: Delivered
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:
    • Author:
      Staffan Larsen
    • JEP Type:
    • Exposure:
    • Subcomponent:
    • Scope:
    • Discussion:
      serviceability dash dev at openjdk dot java dot net
    • Effort:
    • Duration:
    • JEP Number:



      Provide infrastructure for detailed tracing of the JVM, and add tracing to all sub-components of the JVM.


      It is not a goal of this project to provide visualization or analysis of trace data.

      Success Metrics

      • No measurable performance overhead when not enabled.


      Capturing detailed information about the inner workings of the JVM can be useful for both performance tuning by customers as well as for debugging and servicing.


      The infrastructure will be designed to allow for a low-overhead implementation. Tracing will be done in the form of events that carry data. These events will also carry meta-data to facilitate rendering of the information.

      Examples of events are "Young Generation Collection" and "Method Compiled". Each event has a number of fields that can contain additional information about the event. For example, "Heap Usage Before" and "Method Name" would be included in the previous two events. In addition, events contain the thread they occured in as well as timing information.

      Event timing

      Events are automatically time stamped. For the purpose of timing there are two different classes of events:

      • Instant events: these have only a single timestamp
      • Timed events: these have a start and an end time

      Event Definition

      All events are defined in the source code with a full description of the event as well as all the fields in the event. The description includes the data types and content types of the fields as well as a human readable description of the event.

      Data type refers to the binary encoding of the data. Examples are string, int and float.

      Content type refers to the semantic value of the data. Examples are bytes, milliseconds and percentage.

      The purpose of including lots of meta-data about events and fields is to make it possible for clients of the data to make sense of it and display it in an appropriate fashion.

      Event Instrumentation

      The source code of the JVM is instrumented with creation of events. Instrumentation typically looks something like:

      size_t heapSizeBefore, heapSizeAfter;
      EventYoungCollection yc_event;
      // Do the collection here and set the values
      // of heapSizeBefore and heapSizeAfter

      If the instrumented code is performance critical, the last three statements can be made conditional on yc_event.should_commit() which will make sure these statements aren't executed unless tracing is enabled.


      One alternative approach already present in the JVM is DTrace probes. Some shortcomings of DTrace in terms of instrumenting the JVM:

      • Only available on Solaris and OS X (although there are efforts to port it to Linux).
      • Does not include detailed meta-data about the information it exposes.
      • Has only an implicit tie between the start- and end-point of an event.


      Apart from unit tests it it important to test that the performance characteristics of the JVM are not impacted by the instrumentatation. When instrumentation is turned off, the performance impact should not be measurable.


      • Performance/scalability: As stated above, performance should not be impacted when instrumentation is turned off.


        There are no comments yet on this issue.


          • Assignee:
            sla Staffan Larsen
            sla Staffan Larsen
            Staffan Larsen
            Reviewed By:
            John Coomes (Inactive)
            Endorsed By:
            John Coomes (Inactive), Mikael Vidstedt
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: