RFR: 8327450: The result of jfr view active-settings is invalid if jfr file is created by JDK 11 or JDK 8
Erik Gahlin
egahlin at openjdk.org
Thu Mar 7 00:08:51 UTC 2024
On Wed, 6 Mar 2024 12:22:25 GMT, Long Yang <duke at openjdk.org> wrote:
> Hi all
>
> Could I have a review of this patch for [JDK-8327450](https://bugs.openjdk.org/browse/JDK-8327450)?
>
> If the jfr file is created by `JDK 8` or `JDK 11`, and use `jfr view `to show the `active-settings` view, the result is invalid, missing many settings.
>
> jfr view active-settings j11.jfr
>
> Active Settings
>
> Event Type Enabled Threshold Stack Trace Period Cutoff Throttle
> ------------- ---------- ------------ -------------- --------- --------- -----------
> File Force true 20 ms true
>
>
> jfr summary j11.jfr
> ...
> Event Type Count Size (bytes)
> =============================================================
> ...
> jdk.ActiveSetting 292 9528
> ...
>
>
> The reason is the `endTime` of `jdk.ActiveSetting` on `JDK 8` or `JDK 11` increases naturally, the time between two consecutive events is approximately a few microseconds, but the `query statement` of `active-settings` view used `LAST_BATCH()`, It assumes that the end time of events are the same.
> For JDK 17 and above, this assumption is correct, but not for JDK 8 and JDK 11.
>
> My solution is to truncate the endTime to the second.
>
> Although `jfr view` was released in `JDK 21`, it would make some sense if it could support JFR files created by `JDK 8` and `11`.
>
> Testing:
> test/jdk/jdk/jfr/tool/TestView.java
> test/jdk/jdk/jfr/jcmd/TestJcmdView.java
>
> All passed.
There are no guarantees that values will be emitted within a second. Also, not sure the tool (generally) should support recordings from six year old releases.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18137#issuecomment-1982075132
More information about the hotspot-jfr-dev
mailing list