RFR: 8342818: Implement CPU Time Profiling for JFR [v3]

Johannes Bechberger jbechberger at openjdk.org
Wed Oct 30 18:26:14 UTC 2024


On Wed, 30 Oct 2024 18:14:56 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:

>> src/jdk.jfr/share/classes/jdk/jfr/internal/EventControl.java line 84:
>> 
>>> 82:             addControl(Threshold.NAME, defineThreshold(eventType));
>>> 83:         }
>>> 84:         if (eventType.hasStackTrace() && !eventType.isCPUTimeMethodSampling()) {
>> 
>> The second clause is not really needed, right? I don't think the CPUTimeMethodSampling event hasStacktrace() is true.
>> 
>> The event has a separate StackTrace field, but that is not what is being checked here.
>
> It is needed, because otherwise the `TestDefaultConfigurations` test fails:
> 
> 
> java.lang.Exception: Setting 'stackTrace' in event 'jdk.CPUTimeSample' was not configured in the configuration 'default'
> Setting 'stackTrace' in event 'jdk.CPUTimeSample' was not configured in the configuration 'profile'
> 
>         at jdk.jfr.event.metadata.TestDefaultConfigurations.throwExceptionWithErrors(TestDefaultConfigurations.java:115)
>         at jdk.jfr.event.metadata.TestDefaultConfigurations.main(TestDefaultConfigurations.java:76)
>         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:573)
>         at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
>         at java.base/java.lang.Thread.run(Thread.java:1575)

The problem is, is that `eventType.hasStackTrace()` checks for the existence of a field called `stackTrace`, which CPUTimeSample events have. We could of course rename the field to something like `recordedStackTrace`, but I don't think that this is helpful.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20752#discussion_r1823177332


More information about the hotspot-dev mailing list