OperationType in SafepointBegin event

Jean-Philippe Bempel jean-philippe.bempel at datadoghq.com
Tue Nov 24 15:57:48 UTC 2020


Hello All,

With default JFR settings (default.jfc) you may end up with no 1:1
mapping between SafepointBegin event and ExecuteVMOperation event.
While having ExecuteVMOperation without SafepointBegin could be normal
(Some VMOperation does not require Safepoint like Handshake for
example), Having a SafepointBegin should normally be associated with a
VM operation.

By default JFR settings record SafepointBegin & ExecutionVMOperation
events greater than 10ms (threshold). So your VM Operation could be
quick (less than 10ms, so not recorded along with VMOperation type)
but the SafepointBegin event can have a long duration because bringing
all Java threads at safepoint (so called Time-To-SafePoint) can take
several ms in itself (ex System.arraycopy call on large buffers).

So you’re ending up with a long SafepointBegin event, but without
ExecuteVMOperation event associated, and could not figure out what
triggers this safepoint.
Currently, SafepointBegin event does not record the VMOperation
type[1] unlike ExecuteVMOperation event[2] which does not facilitate
the troubleshooting.

Note: Xlog tracing (-Xlog:safepoint) give us the VMOperation type[3]

My proposal is the following:

Add the same operation field in SafepointBegin than in
ExecuteVMOperation event in metadata.xml and modify
post_safepoint_begin_event to add VMThread::vm_op_type() and set it
into the event.
If you are ok with that I can open a ticket and push a PR.

Regards,
Jean-Philippe

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/jfr/metadata/metadata.xml#L560
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/jfr/metadata/metadata.xml#L589
[3] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/safepoint.cpp#L1114-L1125


More information about the hotspot-jfr-dev mailing list