When analyzing JFR recordings via the Java API, comparing RecordedFrame objects using HashSet or equals/hashCode doesn't work as expected. Frames are inlined structs (each a distinct object), while methods are stored as shared references, so RecordedMethod equality works but RecordedFrame equality doesn't. Since RecordedObject doesn't implement hashCode/equals, object identity is used by default. The workaround is a wrapper record that accesses the internal 'objects' field via reflection (requiring --add-opens jdk.jfr/jdk.jfr.consumer=ALL-UNNAMED) to implement content-based equality. The post also covers safepoint bias in OpenJDK profilers and how DebugNonSafepoints can improve line-number accuracy.

8m read timeFrom mostlynerdless.de
Post cover image
Table of contents
ExampleThe Number of Unique Methods and FramesFrames and the Safepoint BiasFrames and EqualityMain DifferenceA Wrapper to Compare Them AllConclusionAuthorRelated Posts:

Sort: