A proposal selling asynchronous stack traces in Java is advancing by way of the OpenJDK’s Java enhancement process.
The plan, Asynchronous Stack Trace VM API, would outline an AsyncGetStackTrace
API to gather stack traces asynchronously and embody information on each Java and native stack frames. Targets of the hassle embody provision of a well-tested API for profilers, which might get hold of the Java native stack frames data, and help for asynchronous utilization, reminiscent of calling from sign handlers.
As per the proposal, efficiency wouldn’t be affected when the API just isn’t in use and reminiscence necessities wouldn’t be considerably elevated in comparison with the present AsyncGetCallTrace
API. The brand new API wouldn’t be advisable for manufacturing use, as a result of it may crash the JVM. Plans name for minimizing the probabilities of that by way of in depth testing and fuzzing.
Presently, AsyncGetCallTrace
is utilized by most obtainable profilers, each open supply and business, together with async-profiler. Nevertheless it has two main disadvantages. It’s an inner API, not exported in any header, and it solely returns details about Java frames, specifically their methodology and bytecode indices. These points make implementing profilers and associated instruments harder. Though further data might be extracted from the HotSpot VM by way of advanced code, different helpful data stays hidden, reminiscent of whether or not a compiled Java body is inlined, the compilation stage of a Java body, and knowledge on C/C++ frames not on the high of the stack. This information might be useful for profiling and tuning a VM for a given utility and for profiling code that closely makes use of JNI (Java Native Interface).
The AsyncGetStackTrace
API could be modeled on the AsyncGetCallTrace
API. The brand new API has not but been proposed for a particular model of ordinary Java. The following model of Java is Java Development Kit (JDK) 20, which is predicted in March 2023.
Copyright © 2022 IDG Communications, Inc.