Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

harship04
Copy link

@harship04 harship04 commented Apr 11, 2025

Capture and store process pid and commandLine for JFR system processes events events.

Capture and store process `pid` and `commandLine` for JFR events.
@@ -502,6 +510,7 @@ class VM_JFRConstantPoolTypes {

U_32 getMethodEntry(J9ROMMethod *romMethod, J9Class *ramClass);


Copy link
Contributor

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)
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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

@tajila
Copy link
Contributor

tajila commented Apr 11, 2025

Please add a test case to validate the event is emitted in jfr_events.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants