RFR: 8352738: Implement JEP 520: JFR Method Timing and Tracing

Erik Gahlin egahlin at openjdk.org
Thu May 22 13:20:56 UTC 2025


On Thu, 22 May 2025 12:31:59 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Could I have a review of this enhancement that will add tracing capabilities to JFR? There are opportunities for performance improvements in the implementation, but I would rather add them later and separately.
>> 
>> Testing: tier 1-3, test/jdk/jdk/jfr
>> 
>> Thanks
>> Erik
>
> src/jdk.jfr/share/classes/jdk/jfr/tracing/MethodTracer.java line 53:
> 
>> 51:         long endTime = JVM.counterTime();
>> 52:         long duration = endTime - startTime;
>> 53:         if (MethodTraceEvent.enabled() && JVM.getEventWriter() != null) {
> 
> Comprehension check: This method is "only" called from the instrumented code. Do we then actually know that `MethodTraceEvent` is enabled? Can squeeze a few cycles bypassing this check.

We can't be sure, but it's only called when java.lang.Object::<init> is instrumented. (The second check is needed to avoid recursion when allocating the EventWriter object).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25306#discussion_r2102542491


More information about the hotspot-dev mailing list