Advanced profiling proposed for Java Flight Recorder

Skogsluft project would introduce profiling features that span Java and native code execution and provide more precise and flexible profiling options.

shutterstock 1710798856 airplane cockpit instrument panel
Armin E / Shutterstock

Java’s profiling capabilities would be improved within the Java Flight Recorder (JFR), a tool for collecting diagnostic and profiling data in running Java applications, under a proposal floating in the OpenJDK community.

Called Skogsluft, the project would introduce advanced profiling features to bridge the gap between Java and native code execution and offer more precise and flexible profiling options. Skogsluft would focus on three key enhancements, the proposal states:

  • An improved stackwalker, capable of walking mixed Java and native stacks. This would provide developers with a more coherent view of stack traces, particularly in applications where Java and native code are interwoven.
  • A flexible CPU sampler scheduler. For Linux, this would be on perf_event_open or timer_create. For macOS, itimer would be used. For other operating systems, the system would fall back to standard execution samples. This enhancement is intended to offer more accurate, adaptable CPU sampling.
  • Labeling support for JFR, with developers able to set per-thread-key-value labels that are incorporated into any JFR event. This labeling would provide richer context in profiling data, enabling more targeted debugging and analysis.

The JFR API would be extended to support easy and flexible labeling of threads to ensure that the labels are consistently captured in profiling data. The project would start with a clone of the planned JDK 23 mainline release, which is due in September, and track mainline releases going forward.

Copyright © 2024 IDG Communications, Inc.