Skip to content

Commit ae80212

Browse files
committed
Add JFR InitialSystemProperty event support
Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
1 parent 0985ff3 commit ae80212

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

runtime/vm/JFRChunkWriter.cpp

+29
Original file line numberDiff line numberDiff line change
@@ -786,4 +786,33 @@ VM_JFRChunkWriter::writeOSInformationEvent()
786786
return dataStart;
787787
}
788788

789+
void
790+
VM_JFRChunkWriter::writeInitialSystemPropertyEvents(J9JavaVM *vm)
791+
{
792+
pool_state walkState;
793+
794+
J9VMSystemProperty *property = (J9VMSystemProperty *)pool_startDo(vm->systemProperties, &walkState);
795+
while (property != NULL) {
796+
/* reserve size field */
797+
U_8 *dataStart = _bufferWriter->getAndIncCursor(sizeof(U_32));
798+
799+
/* write event type */
800+
_bufferWriter->writeLEB128(InitialSystemPropertyID);
801+
802+
/* write start time */
803+
_bufferWriter->writeLEB128(j9time_current_time_millis());
804+
805+
/* write key */
806+
writeStringLiteral(property->name);
807+
808+
/* write value */
809+
writeStringLiteral(property->value);
810+
811+
/* write size */
812+
_bufferWriter->writeLEB128PaddedU32(dataStart, _bufferWriter->getCursor() - dataStart);
813+
814+
property = (J9VMSystemProperty *)pool_nextDo(&walkState);
815+
}
816+
}
817+
789818
#endif /* defined(J9VM_OPT_JFR) */

runtime/vm/JFRChunkWriter.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ enum MetadataTypeID {
6868
JVMInformationID = 86,
6969
OSInformationID = 87,
7070
VirtualizationInformationID = 88,
71+
InitialSystemPropertyID = 89,
7172
CPUInformationID = 92,
7273
PhysicalMemoryID = 107,
7374
ExecutionSampleID = 108,
@@ -153,6 +154,7 @@ class VM_JFRChunkWriter {
153154
static constexpr int VIRTUALIZATION_INFORMATION_EVENT_SIZE = 50;
154155
static constexpr int CPU_INFORMATION_EVENT_SIZE = 600;
155156
static constexpr int OS_INFORMATION_EVENT_SIZE = 100;
157+
static constexpr int INITIAL_SYSTEM_PROPERTY_EVENT_SIZE = 6000;
156158

157159
static constexpr int METADATA_ID = 1;
158160

@@ -330,6 +332,8 @@ class VM_JFRChunkWriter {
330332
writeVirtualizationInformationEvent();
331333

332334
writeOSInformationEvent();
335+
336+
writeInitialSystemPropertyEvents(_vm);
333337
}
334338

335339
writePhysicalMemoryEvent();
@@ -531,6 +535,8 @@ class VM_JFRChunkWriter {
531535

532536
U_8 *writeOSInformationEvent();
533537

538+
void writeInitialSystemPropertyEvents(J9JavaVM *vm);
539+
534540
UDATA
535541
calculateRequiredBufferSize()
536542
{
@@ -579,6 +585,7 @@ class VM_JFRChunkWriter {
579585

580586
requireBufferSize += CPU_INFORMATION_EVENT_SIZE;
581587

588+
requireBufferSize += INITIAL_SYSTEM_PROPERTY_EVENT_SIZE;
582589
return requireBufferSize;
583590
}
584591

0 commit comments

Comments
 (0)