RFR: 8325502: JFR: The type of EventSystemProcess::pid should be long
Erik Gahlin
egahlin at openjdk.org
Thu Feb 8 19:52:02 UTC 2024
On Thu, 8 Feb 2024 14:45:05 GMT, Denghui Dong <ddong at openjdk.org> wrote:
> Hi,
>
> Please review this patch that changes the type of `EventSystemProcess::pid` to `long`
>
> Thanks
If the System Process event was new, it would make sense to make the pid field use a long type, but when the event was introduced in Oracle JDK 7u40, there was no ProcessHandle API, only com.sun.tools.attach.VirtualMachine::id() which returns a string value. The benefit of using a long value seems small compared to all the existing code that might break with a ClassCastException, i.e.
String pid = event.getValue("pid")
and the trouble of always checking the type in case the recording is older, i.e.
long pid;
if (event.getEventType().getField("pid").getTypeName().equals("java.lang.String")) {
pid = Long.parseLong(event.getString("pid"));
} else {
pid = event.getLong("pid").
}
Furthermore, there seeems to be a bug in JMC which renders long values in scientific notation, so user may not be able to read the value if it's changed.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17773#issuecomment-1934828046
More information about the hotspot-jfr-dev
mailing list