-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add system processes event #21631
base: master
Are you sure you want to change the base?
Add system processes event #21631
Conversation
Capture and store process `pid` and `commandLine` for JFR events.
@@ -502,6 +510,7 @@ class VM_JFRConstantPoolTypes { | |||
|
|||
U_32 getMethodEntry(J9ROMMethod *romMethod, J9Class *ramClass); | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these extrsa blank lines are not needed
@@ -1246,6 +1266,41 @@ class VM_JFRConstantPoolTypes { | |||
gcConfiguration->heapAddressBits = J9JAVAVM_REFERENCE_SIZE(vm) * 8; | |||
} | |||
|
|||
uintptr_t recordSystemProcessEvent(uintptr_t pid, const char *commandLine, void *userData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make this a static so you dont need tempProcessCallback
char pidString[32]; | ||
snprintf(pidString, sizeof(pidString), "%lu", (unsigned long)pid); | ||
entry->pid = strdup(pidString); | ||
entry->commandLine = strdup(commandLine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add a counter and keep track of the length of the string (+= strlen(commandLine)
) so requiredBufferSize
can be more accurate
_writer->writeStringLiteral(entry->pid); | ||
|
||
/* Write command line */ | ||
_writer->writeStringLiteral(entry->commandLine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can free and NULL the string after you write it to the chunk
Please add a test case to validate the event is emitted in jfr_events.xml |
Capture and store process
pid
andcommandLine
for JFR system processes events events.