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

Erik Gahlin egahlin at openjdk.org
Wed Oct 30 21:16:27 UTC 2024


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

>> 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.

Shouldn't the event have a stackTrace setting and the setting be set to true in default.jfc, similar to ObjectAlllocationSample?

metadata.xml:
  <Event name="ObjectAllocationSample" thread="true" stackTrace="true" startTime="false" throttle="true">
    <Field type="Class" name="objectClass" label="Object Class" />
    <Field type="long" contentType="bytes" name="weight"  />
  </Event>

default.jfc:
  <event name="jdk.ObjectAllocationSample">
    <setting name="enabled">true</setting>
    <setting name="throttle">150/s</setting>
    <setting name="stackTrace">true</setting>
  </event>

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

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


More information about the hotspot-dev mailing list