Skip to content

Commit

Permalink
Merge pull request #20649 from tajila/jfr2
Browse files Browse the repository at this point in the history
(0.49) Recent JFR fixes
  • Loading branch information
pshipton authored Nov 20, 2024
2 parents c73c323 + c4edde8 commit 60af720
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,10 @@ private static void ensureProperties(boolean isInitialization) {
/*[ENDIF] CRIU_SUPPORT */

/*[IF JFR_SUPPORT]*/
/* Enables openj9 JFR tests. */
initializedProperties.put("org.eclipse.openj9.jfr.isJFREnabled", "true"); //$NON-NLS-1$ //$NON-NLS-2$
/* TODO disable JFR JCL APIs until JFR natives are implemented. */
initializedProperties.put("jfr.unsupported.vm", "true"); //$NON-NLS-1$ //$NON-NLS-2$
/*[ENDIF] JFR_SUPPORT */

String[] list = getPropertyList();
Expand Down
9 changes: 9 additions & 0 deletions runtime/vm/JFRConstantPoolTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,15 @@ VM_JFRConstantPoolTypes::addThreadGroupEntry(j9object_t threadGroup)
entry->parentIndex = addThreadGroupEntry(J9VMJAVALANGTHREADGROUP_PARENT(_currentThread, threadGroup));
if (isResultNotOKay()) goto done;

/* Check again to see if the Threadgroup was added recursively. */
entry = (ThreadGroupEntry *) hashTableFind(_threadGroupTable, entry);
if (NULL != entry) {
index = entry->index;
goto done;
} else {
entry = &entryBuffer;
}

entry->name = copyStringToJ9UTF8WithMemAlloc(_currentThread, J9VMJAVALANGTHREADGROUP_NAME(_currentThread, threadGroup), J9_STR_NONE, "", 0, NULL, 0);

entry->index = _threadGroupCount;
Expand Down
2 changes: 2 additions & 0 deletions runtime/vm/jfr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,9 +979,11 @@ jfrSamplingThreadProc(void *entryArg)
while (J9JFR_SAMPLER_STATE_STOP != vm->jfrSamplerState) {
J9SignalAsyncEvent(vm, NULL, vm->jfrAsyncKey);
if (0 == (count % 100)) { // 1 second
omrthread_monitor_exit(vm->jfrSamplerMutex);
internalAcquireVMAccess(currentThread);
jfrCPULoad(currentThread);
internalReleaseVMAccess(currentThread);
omrthread_monitor_enter(vm->jfrSamplerMutex);
if (0 == (count % 1000)) { // 10 seconds
J9SignalAsyncEvent(vm, NULL, vm->jfrThreadCPULoadAsyncKey);
}
Expand Down

0 comments on commit 60af720

Please sign in to comment.