Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7153 from dmitripivkine/master
Browse files Browse the repository at this point in the history
Allow Last Responder thread pointer to be NULL
  • Loading branch information
babsingh authored Oct 24, 2023
2 parents 501add5 + 22e3979 commit 9bec530
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions gc/verbose/VerboseHandlerOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,12 @@ MM_VerboseHandlerOutput::handleExclusiveStart(J9HookInterface** hook, uintptr_t
manager->setLastExclusiveAccessStartTime(currentTime);

OMR_VMThread* lastResponder = event->lastResponder;
char escapedLastResponderName[64];
getThreadName(escapedLastResponderName,sizeof(escapedLastResponderName),lastResponder);
char escapedLastResponderName[64] = "";

/* Last Responder thread can be passed NULL in the case of Safe Point Exclusive */
if (NULL != lastResponder) {
getThreadName(escapedLastResponderName, sizeof(escapedLastResponderName), lastResponder);
}

char tagTemplate[200];
getTagTemplate(tagTemplate, sizeof(tagTemplate), manager->getIdAndIncrement(), omrtime_current_time_millis());
Expand All @@ -608,8 +612,12 @@ MM_VerboseHandlerOutput::handleExclusiveStart(J9HookInterface** hook, uintptr_t
writer->formatAndOutput(env, 0, "<warning details=\"clock error detected, following timing may be inaccurate\" />");
}
writer->formatAndOutput(env, 0, "<exclusive-start %s intervalms=\"%llu.%03.3llu\">", tagTemplate, deltaTime / 1000, deltaTime % 1000);
writer->formatAndOutput(env, 1, "<response-info timems=\"%llu.%03.3llu\" idlems=\"%llu.%03.3llu\" threads=\"%zu\" lastid=\"%p\" lastname=\"%s\" />",
exclusiveAccessTime / 1000, exclusiveAccessTime % 1000, meanIdleTime / 1000, meanIdleTime % 1000, event->haltedThreads, (NULL == lastResponder ? NULL : lastResponder->_language_vmthread), escapedLastResponderName);

writer->formatAndOutput(
env, 1, "<response-info timems=\"%llu.%03.3llu\" idlems=\"%llu.%03.3llu\" threads=\"%zu\" lastid=\"%p\" lastname=\"%s\" />",
exclusiveAccessTime / 1000, exclusiveAccessTime % 1000, meanIdleTime / 1000, meanIdleTime % 1000, event->haltedThreads,
(NULL == lastResponder ? NULL : lastResponder->_language_vmthread), escapedLastResponderName);

writer->formatAndOutput(env, 0, "</exclusive-start>");
writer->flush(env);
exitAtomicReportingBlock();
Expand Down

0 comments on commit 9bec530

Please sign in to comment.