Integrated: 8239508 JFR: @RemoveFields
Erik Gahlin
egahlin at openjdk.org
Tue Oct 31 15:39:47 UTC 2023
On Sun, 29 Oct 2023 17:40:08 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> This enhancement introduces an annotation that controls the presence of implicit fields for an event.
>
> For native events, the metadata.xml file controls the existence of the fields "eventThread" "duration” and "stackTrace”. For Java events, there is nothing similar. This outage has been known since the inception of the jdk.jfr API. At that time, we decided to ignore it and write 0 for “eventThread”, “stackTrace”, and ”duration”. The gain was a simplified programming model with one annotation, i.e. StackTrace, instead of two, i.e. StackTrace and HasStackTrace, to determine if a value should be recorded.
>
> With the removal of event handlers ([JDK-8282420](https://bugs.openjdk.org/browse/JDK-8282420) ) and use of the new Class-File API ([JDK-8318124](https://bugs.openjdk.org/browse/JDK-8318124)) this capability can be added to Java events at a lower implementation cost. Also, we are considering adding other fields, such as allocation, cpuTime, or socketRead/Write, that can occur between a call to Event::begin() and Event::end().
>
> There is still uncertainty about the design of the annotation, so it is currently only accessible to JDK events. Instead of a separate annotation per field, i.e. HasStackTrace, HasEventThread, and HasDuration, there is one annotation, RemoveFields, that provides a list of fields that should be dropped. This allows for a corresponding annotation, AddFields, to be included in the future, for example, to add the field cpuTime.
>
> The benefits of the change are:
>
> - a more compact recording file
> - less overhead
> - no mismatch between contents of .jfc files and what the API provides
> - consistency with native events
> - less noise when events are visualized
>
> Testing: test/jdk/jdk/jfr/ tier1 + tier2
This pull request has now been integrated.
Changeset: 2d5829af
Author: Erik Gahlin <egahlin at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/2d5829afbcc022297940cbf436b14725a9251b3c
Stats: 611 lines in 43 files changed: 392 ins; 120 del; 99 mod
8239508: JFR: @RemoveFields
Reviewed-by: mgronlun
-------------
PR: https://git.openjdk.org/jdk/pull/16411
More information about the hotspot-jfr-dev
mailing list