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

Johannes Bechberger jbechberger at openjdk.org
Wed Oct 30 18:22:35 UTC 2024


On Wed, 30 Oct 2024 14:11:01 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix tests and other minor improvements
>
> 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)

> src/jdk.jfr/share/conf/jfr/profile.jfc line 195:
> 
>> 193:     <event name="jdk.CPUTimeSample">
>> 194:       <setting name="enabled" control="method-sampling-enabled">false</setting>
>> 195:       <setting name="throttle">10ms</setting>
> 
> Can a rate be given here instead of an absolute value? Otherwise, there is a mismatch between the default. jfc and the profile.jfc which seems quite unintuitive.

I wanted to give the user the info that both formats are usable (because this is documented nowhere else) and in profiling we usually don't care about having too many events.

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

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


More information about the hotspot-dev mailing list