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

Make JFR compile on z/OS #20773

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ typedef struct J9JFRCPULoad {

typedef struct J9JFRThreadCPULoad {
J9JFR_EVENT_COMMON_FIELDS
float user;
float system;
float userCPULoad;
float systemCPULoad;
} J9JFRThreadCPULoad;

typedef struct J9JFRClassLoadingStatistics {
Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/JFRChunkWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,10 @@ class VM_JFRChunkWriter {
_bufferWriter->writeLEB128(entry->threadIndex);

/* write user thread CPU load */
_bufferWriter->writeFloat(entry->user);
_bufferWriter->writeFloat(entry->userCPULoad);

/* write system thread CPU load */
_bufferWriter->writeFloat(entry->system);
_bufferWriter->writeFloat(entry->systemCPULoad);

/* write size */
_bufferWriter->writeLEB128PaddedU32(dataStart, _bufferWriter->getCursor() - dataStart);
Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/JFRConstantPoolTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,8 +1130,8 @@ VM_JFRConstantPoolTypes::addThreadCPULoadEntry(J9JFRThreadCPULoad *threadCPULoad
}

entry->ticks = threadCPULoadData->startTicks;
entry->user = threadCPULoadData->user;
entry->system = threadCPULoadData->system;
entry->userCPULoad = threadCPULoadData->userCPULoad;
entry->systemCPULoad = threadCPULoadData->systemCPULoad;

entry->threadIndex = addThreadEntry(threadCPULoadData->vmThread);
if (isResultNotOKay()) {
Expand Down
24 changes: 12 additions & 12 deletions runtime/vm/JFRConstantPoolTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ struct CPULoadEntry {
struct ThreadCPULoadEntry {
I_64 ticks;
U_32 threadIndex;
float user;
float system;
float userCPULoad;
float systemCPULoad;
};

struct ClassLoadingStatisticsEntry {
Expand Down Expand Up @@ -1268,47 +1268,47 @@ class VM_JFRConstantPoolTypes {
* zero is NULL threadGroup.
*/
_stringUTF8Count += 1;
_defaultStringUTF8Entry = {0};
memset(&_defaultStringUTF8Entry, 0, sizeof(_defaultStringUTF8Entry));
_defaultStringUTF8Entry.string = (J9UTF8*)&nullString;

_stringUTF8Count += 1;
_unknownClassStringUTF8Entry = {0};
memset(&_unknownClassStringUTF8Entry , 0, sizeof(_unknownClassStringUTF8Entry));
_unknownClassStringUTF8Entry.string = (J9UTF8*)&unknownClass;

_stringUTF8Count += 1;
_nativeMethodStringUTF8Entry = {0};
memset(&_nativeMethodStringUTF8Entry, 0, sizeof(_nativeMethodStringUTF8Entry));
_nativeMethodStringUTF8Entry.string = (J9UTF8*)&nativeMethod;

_stringUTF8Count += 1;
_nativeMethodSignatureStringUTF8Entry = {0};
memset(&_nativeMethodSignatureStringUTF8Entry, 0, sizeof(_nativeMethodSignatureStringUTF8Entry));
_nativeMethodSignatureStringUTF8Entry.string = (J9UTF8*)&nativeMethodSignature;

_moduleCount += 1;
_defaultModuleEntry = {0};
memset(&_defaultModuleEntry, 0, sizeof(_defaultModuleEntry));
_firstModuleEntry = &_defaultModuleEntry;
_previousModuleEntry = _firstModuleEntry;

_packageCount += 1;
_defaultPackageEntry = {0};
memset(&_defaultPackageEntry, 0, sizeof(_defaultPackageEntry));
_defaultPackageEntry.exported = TRUE;
_defaultPackageEntry.packageName = J9UTF8_DATA((J9UTF8*) &defaultPackage);
_defaultPackageEntry.packageNameLength = J9UTF8_LENGTH((J9UTF8*) &defaultPackage);
_firstPackageEntry = &_defaultPackageEntry;
_previousPackageEntry = _firstPackageEntry;

_threadGroupCount += 1;
_defaultThreadGroup = {0};
memset(&_defaultThreadGroup, 0, sizeof(_defaultThreadGroup));
_firstThreadGroupEntry = &_defaultThreadGroup;
_previousThreadGroupEntry = _firstThreadGroupEntry;

_classCount += 1;
_defaultClassEntry = {0};
memset(&_defaultClassEntry, 0, sizeof(_defaultClassEntry));
_defaultClassEntry.nameStringUTF8Index = (U_32)UnknownClass;
_firstClassEntry = &_defaultClassEntry;
_previousClassEntry = _firstClassEntry;

_methodCount += 1;
_defaultMethodEntry = {0};
memset(&_defaultMethodEntry, 0, sizeof(_defaultMethodEntry));
_defaultMethodEntry.nameStringUTF8Index = (U_32)NativeMethod;
_defaultMethodEntry.descriptorStringUTF8Index = (U_32)NativeMethodSignature;
/* default class */
Expand All @@ -1317,7 +1317,7 @@ class VM_JFRConstantPoolTypes {
_previousMethodEntry = _firstMethodEntry;

_stackTraceCount += 1;
_defaultStackTraceEntry = {0};
memset(&_defaultStackTraceEntry, 0, sizeof(_defaultStackTraceEntry));
_firstStackTraceEntry = &_defaultStackTraceEntry;
_previousStackTraceEntry = _firstStackTraceEntry;

Expand Down
8 changes: 4 additions & 4 deletions runtime/vm/jfr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,12 +939,12 @@ jfrThreadCPULoad(J9VMThread *currentThread, J9VMThread *sampleThread)
int64_t currentTime = j9time_nano_time();

if (-1 == jfrState->prevTimestamp) {
jfrEvent->user = 0;
jfrEvent->system = 0;
jfrEvent->userCPULoad = 0;
jfrEvent->systemCPULoad = 0;
} else {
int64_t timeDelta = currentTime - jfrState->prevTimestamp;
jfrEvent->user = OMR_MIN((threadTimes.userTime - jfrState->prevThreadCPUTimes.userTime) / (double)timeDelta, 1.0);
jfrEvent->system = OMR_MIN((threadTimes.sysTime - jfrState->prevThreadCPUTimes.sysTime) / (double)timeDelta, 1.0);
jfrEvent->userCPULoad = OMR_MIN((threadTimes.userTime - jfrState->prevThreadCPUTimes.userTime) / (double)timeDelta, 1.0);
jfrEvent->systemCPULoad = OMR_MIN((threadTimes.sysTime - jfrState->prevThreadCPUTimes.sysTime) / (double)timeDelta, 1.0);
}
jfrState->prevTimestamp = currentTime;
jfrState->prevThreadCPUTimes = threadTimes;
Expand Down