--- a/src/hotspot/share/jfr/metadata/metadata.xml Sat Dec 08 14:08:04 2018 +0100
+++ b/src/hotspot/share/jfr/metadata/metadata.xml Sat Dec 08 17:41:17 2018 +0100
@@ -613,7 +613,8 @@
<Field type="string" name="jvmFlags" label="JVM Settings File Arguments" />
<Field type="string" name="javaArguments" label="Java Application Arguments" />
<Field type="long" contentType="epochmillis" name="jvmStartTime" label="JVM Start Time" />
- </Event>
+ <Field type="long" name="pid" label="Process Identifier" />
+ </Event>
<Event name="OSInformation" category="Operating System" label="OS Information" period="endChunk">
<Field type="string" name="osVersion" label="OS Version" />
--- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp Sat Dec 08 14:08:04 2018 +0100
+++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp Sat Dec 08 17:41:17 2018 +0100
@@ -79,6 +79,7 @@
event.set_jvmArguments(Arguments::jvm_args());
event.set_jvmFlags(Arguments::jvm_flags());
event.set_jvmStartTime(Management::vm_init_done_time());
+ event.set_pid(os::current_process_id());
event.commit();
}
--- a/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java Sat Dec 08 14:08:04 2018 +0100
+++ b/test/jdk/jdk/jfr/event/runtime/TestVMInfoEvent.java Sat Dec 08 17:41:17 2018 +0100
@@ -64,6 +64,8 @@
String jvmArgs = Events.assertField(event, "jvmArguments").notNull().getValue();
String jvmFlags = Events.assertField(event, "jvmFlags").notNull().getValue();
+ Long pid = Events.assertField(event, "pid").atLeast(0L).getValue();
+ Asserts.assertEquals(pid, ProcessHandle.current().pid());
String eventArgs = (jvmFlags.trim() + " " + jvmArgs).trim();
String beanArgs = mbean.getInputArguments().stream().collect(Collectors.joining(" "));
Asserts.assertEquals(eventArgs, beanArgs, "Wrong inputArgs");