RFR: 8284686: Interval of < 1 ms disables ExecutionSample events [v6]
Jaroslav Bachorik
jbachorik at openjdk.java.net
Thu May 5 13:07:38 UTC 2022
On Thu, 5 May 2022 11:02:09 GMT, Johannes Bechberger <duke at openjdk.java.net> wrote:
>> Fixes the issue by rounding the period interval to the next full millisecond larger than zero.
>>
>> The following from the bug report works now:
>>
>> java -XX:StartFlightRecording=filename=flight.jfr,jdk.ExecutionSample#period=999us CLASS_FILE; jfr print --events jdk.ExecutionSample flight.jfr
>>
>> It considers the period to be `1ms`, producing the recording as expected.
>
> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision:
>
> - Add TestShortPeriod
> - Remove TestPeriodSetting
test/jdk/jdk/jfr/api/recording/event/TestShortPeriod.java line 63:
> 61: try (var r = new RecordingStream()) {
> 62: r.enable(EventNames.JVMInformation).withPeriod(Duration.ofNanos(1));
> 63: r.onEvent(e -> r.close());
What happens when the event is, in fact, disabled?
The test will run forever, right?
Could you rather use something like `CountDownLatch` which will get decremented in `onEvent()` handler and the test method would wait for that latch for at most N milliseconds - failing when the wait times out?
-------------
PR: https://git.openjdk.java.net/jdk/pull/8183
More information about the hotspot-jfr-dev
mailing list