Skip to content

Commit 543fdd6

Browse files
committed
recent updates
1 parent 177844e commit 543fdd6

3 files changed

Lines changed: 51 additions & 64 deletions

File tree

runtime/compiler/control/CompilationThread.cpp

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -859,10 +859,10 @@ void TR::CompilationInfo::freeAllResources()
859859

860860
freeAllCompilationThreads();
861861

862-
if (_syncCompStats.longestWaitMethodInfo != NULL) {
862+
if (_syncCompStats.longestWaitMethod != NULL) {
863863
PORT_ACCESS_FROM_JITCONFIG(_jitConfig);
864-
j9mem_free_memory(_syncCompStats.longestWaitMethodInfo);
865-
_syncCompStats.longestWaitMethodInfo = NULL;
864+
j9mem_free_memory(_syncCompStats.longestWaitMethod);
865+
_syncCompStats.longestWaitMethod = NULL;
866866
}
867867
}
868868

@@ -6170,8 +6170,11 @@ void *TR::CompilationInfo::compileOnSeparateThread(J9VMThread *vmThread, TR::IlG
61706170
entry->_numThreadsWaiting++;
61716171

61726172
uint64_t waitStart = 0;
6173+
uint64_t waitStartMs = 0;
6174+
PORT_ACCESS_FROM_JITCONFIG(_jitConfig);
61736175
if (!async) {
6174-
waitStart = getPersistentInfo()->getElapsedTime();
6176+
waitStart = j9time_hires_clock();
6177+
waitStartMs = j9time_current_time_millis();
61756178
}
61766179

61776180
// Release the compilation monitor
@@ -6272,56 +6275,36 @@ void *TR::CompilationInfo::compileOnSeparateThread(J9VMThread *vmThread, TR::IlG
62726275
entry->_numThreadsWaiting--;
62736276

62746277
if (!async) {
6275-
uint64_t waitEnd = getPersistentInfo()->getElapsedTime();
6276-
uint64_t duration = waitEnd - waitStart;
6278+
uint64_t waitEnd = j9time_hires_clock();
6279+
uint64_t duration = j9time_hires_delta(waitStart, waitEnd, J9PORT_TIME_DELTA_IN_MICROSECONDS);
62776280

62786281
_syncCompStats.totalCount++;
62796282
_syncCompStats.totalWaitTime += duration;
62806283

62816284
if (duration > _syncCompStats.longestWaitTime) {
62826285
_syncCompStats.longestWaitTime = duration;
6283-
_syncCompStats.longestWaitTimeStart = waitStart;
6284-
_syncCompStats.longestWaitTimeEnd = waitEnd;
6286+
_syncCompStats.longestWaitTimeStart = waitStartMs;
6287+
_syncCompStats.longestWaitTimeEnd = waitStartMs + (duration / 1000);
62856288

62866289
J9UTF8 *className;
62876290
J9UTF8 *name;
62886291
J9UTF8 *signature;
62896292
getClassNameSignatureFromMethod(method, className, name, signature);
62906293

6291-
PORT_ACCESS_FROM_JITCONFIG(_jitConfig);
6292-
6293-
if (_syncCompStats.longestWaitMethodInfo != NULL) {
6294-
j9mem_free_memory(_syncCompStats.longestWaitMethodInfo);
6295-
_syncCompStats.longestWaitMethodInfo = NULL;
6294+
if (_syncCompStats.longestWaitMethod != NULL) {
6295+
j9mem_free_memory(_syncCompStats.longestWaitMethod);
6296+
_syncCompStats.longestWaitMethod = NULL;
62966297
}
62976298

6298-
uint32_t classNameLen = J9UTF8_LENGTH(className);
6299-
uint32_t nameLen = J9UTF8_LENGTH(name);
6300-
uint32_t signatureLen = J9UTF8_LENGTH(signature);
6301-
6302-
uint32_t totalLen = classNameLen + 1 + nameLen + 1 + signatureLen + 1;
6303-
6304-
char *tempLongestWaitMethodInfo = (char *)j9mem_allocate_memory(totalLen, J9MEM_CATEGORY_JIT);
6305-
if (tempLongestWaitMethodInfo != NULL) {
6306-
char *tempPointer = tempLongestWaitMethodInfo;
6307-
6308-
memcpy(tempPointer, J9UTF8_DATA(className), classNameLen);
6309-
tempPointer += classNameLen;
6310-
*tempPointer = '\0';
6311-
tempPointer++;
6312-
6313-
memcpy(tempPointer, J9UTF8_DATA(name), nameLen);
6314-
tempPointer += nameLen;
6315-
*tempPointer = '\0';
6316-
tempPointer++;
6299+
uint32_t totalLen = J9UTF8_LENGTH(className) + J9UTF8_LENGTH(name) + J9UTF8_LENGTH(signature) + 2;
6300+
char *templongestWaitMethod = (char *)j9mem_allocate_memory(totalLen, J9MEM_CATEGORY_JIT);
63176301

6318-
memcpy(tempPointer, J9UTF8_DATA(signature), signatureLen);
6319-
tempPointer += signatureLen;
6320-
*tempPointer = '\0';
6321-
tempPointer++;
6302+
if (templongestWaitMethod != NULL) {
6303+
snprintf(templongestWaitMethod, totalLen, "%.*s.%.*s%.*s", J9UTF8_LENGTH(className), J9UTF8_DATA(className),
6304+
J9UTF8_LENGTH(name), J9UTF8_DATA(name), J9UTF8_LENGTH(signature), J9UTF8_DATA(signature));
63226305
}
63236306

6324-
_syncCompStats.longestWaitMethodInfo = tempLongestWaitMethodInfo;
6307+
_syncCompStats.longestWaitMethod = templongestWaitMethod;
63256308
}
63266309
}
63276310

runtime/oti/j9nonbuilder.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4321,12 +4321,16 @@ typedef struct J9ClassCastParms {
43214321
} J9ClassCastParms;
43224322

43234323
typedef struct J9JITSyncCompilationStatistics {
4324+
/**
4325+
* All times are in microseconds (us)
4326+
* longestWaitTimeStart and longestWaitTimeEnd are abosulte timestamps
4327+
*/
43244328
uint32_t totalCount;
43254329
uint64_t totalWaitTime;
43264330
uint64_t longestWaitTime;
43274331
uint64_t longestWaitTimeStart;
43284332
uint64_t longestWaitTimeEnd;
4329-
char* longestWaitMethodInfo;
4333+
char* longestWaitMethod;
43304334
} J9JITSyncCompilationStatistics;
43314335

43324336
/* @ddr_namespace: map_to_type=J9JITConfig */

runtime/rasdump/javadump.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,6 +2920,10 @@ JavaCoreDumpWriter::writeHookSection(void)
29202920
void
29212921
JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29222922
{
2923+
char timeStampStart[_MaximumTimeStampLength + 1];
2924+
char timeStampEnd[_MaximumTimeStampLength + 1];
2925+
PORT_ACCESS_FROM_PORT(_PortLibrary);
2926+
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
29232927

29242928
J9JITConfig *jitConfig = _VirtualMachine->jitConfig;
29252929
if (NULL == jitConfig || NULL == jitConfig->syncCompStats) {
@@ -2928,7 +2932,7 @@ JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29282932

29292933
J9JITSyncCompilationStatistics *stats = jitConfig->syncCompStats;
29302934

2931-
_OutputStream.writeCharacters("0SECTION Synchronous compilations info dump routine\n\n");
2935+
_OutputStream.writeCharacters("0SECTION Synchronous compilations info dump routine\n");
29322936
_OutputStream.writeCharacters("NULL ==============================\n");
29332937
_OutputStream.writeCharacters("1NOTE This data is reset after each javacore file is written\n");
29342938
_OutputStream.writeCharacters("NULL ------------------------------------------------------------------------\n");
@@ -2937,36 +2941,33 @@ JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29372941
_OutputStream.writeCharacters("2JITSYNCCOUNT Total synchronous compilations: ");
29382942
_OutputStream.writeInteger(stats->totalCount, "%u");
29392943
_OutputStream.writeCharacters("\n");
2940-
_OutputStream.writeCharacters("2JITTOTALWAIT Total application wait time (JVM uptime ms): ");
2944+
_OutputStream.writeCharacters("2JITTOTALWAIT Total application wait time: ");
29412945
_OutputStream.writeInteger(stats->totalWaitTime, "%llu");
2942-
_OutputStream.writeCharacters("ms\n");
2946+
_OutputStream.writeCharacters("us\n");
29432947
if (stats->longestWaitTime != 0) {
29442948
_OutputStream.writeCharacters("2JITLONGEST Longest Synchronous Compilation\n");
29452949
_OutputStream.writeCharacters("3JITWAITTIME Wait time: ");
29462950
_OutputStream.writeInteger(stats->longestWaitTime, "%llu");
2947-
_OutputStream.writeCharacters("ms\n");
2951+
_OutputStream.writeCharacters("us\n");
29482952

2949-
_OutputStream.writeCharacters("3JITSTARTTIME Wait time start (JVM uptime ms): ");
2950-
_OutputStream.writeInteger64(stats->longestWaitTimeStart, "%llu");
2951-
_OutputStream.writeCharacters("ms\n");
2953+
_OutputStream.writeCharacters("3JITSTARTTIME Wait time start: ");
2954+
omrstr_ftime_ex(timeStampStart, _MaximumTimeStampLength, "%Y-%m-%dT%H:%M:%S", stats->longestWaitTimeStart, OMRSTR_FTIME_FLAG_LOCAL);
2955+
timeStampStart[_MaximumTimeStampLength] = '\0';
2956+
_OutputStream.writeCharacters(timeStampStart);
2957+
_OutputStream.writeInteger64(stats->longestWaitTimeStart % 1000, ".%03llu");
2958+
_OutputStream.writeCharacters("\n");
29522959

2953-
_OutputStream.writeCharacters("3JITENDTIME Wait time end (JVM uptime ms): ");
2954-
_OutputStream.writeInteger64(stats->longestWaitTimeEnd, "%llu");
2955-
_OutputStream.writeCharacters("ms\n");
29562960

2957-
if (stats->longestWaitMethodInfo != NULL) {
2958-
char *className = stats->longestWaitMethodInfo;
2959-
char *name = className + strlen(className) + 1;
2960-
char *signature = name + strlen(name) + 1;
2961+
_OutputStream.writeCharacters("3JITENDTIME Wait time end: ");
2962+
omrstr_ftime_ex(timeStampEnd, _MaximumTimeStampLength, "%Y-%m-%dT%H:%M:%S", stats->longestWaitTimeEnd, OMRSTR_FTIME_FLAG_LOCAL);
2963+
timeStampEnd[_MaximumTimeStampLength] = '\0';
2964+
_OutputStream.writeCharacters(timeStampEnd);
2965+
_OutputStream.writeInteger64(stats->longestWaitTimeEnd % 1000, ".%03llu");
2966+
_OutputStream.writeCharacters("\n");
29612967

2962-
_OutputStream.writeCharacters("3JITMETHODNAME Method Name: ");
2963-
_OutputStream.writeCharacters(name);
2964-
_OutputStream.writeCharacters("\n");
2965-
_OutputStream.writeCharacters("3JITMETHODCLS Method Class: ");
2966-
_OutputStream.writeCharacters(className);
2967-
_OutputStream.writeCharacters("\n");
2968-
_OutputStream.writeCharacters("3JITMETHODSIG Method Signature: ");
2969-
_OutputStream.writeCharacters(signature);
2968+
if (stats->longestWaitMethod != NULL) {
2969+
_OutputStream.writeCharacters("3JITMETHOD Method: ");
2970+
_OutputStream.writeCharacters(stats->longestWaitMethod);
29702971
_OutputStream.writeCharacters("\n");
29712972
}
29722973

@@ -2977,10 +2978,9 @@ JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29772978
stats->longestWaitTime = 0;
29782979
stats->longestWaitTimeStart = 0;
29792980
stats->longestWaitTimeEnd = 0;
2980-
if (stats->longestWaitMethodInfo != NULL) {
2981-
PORT_ACCESS_FROM_PORT(_PortLibrary);
2982-
j9mem_free_memory(stats->longestWaitMethodInfo);
2983-
stats->longestWaitMethodInfo = NULL;
2981+
if (stats->longestWaitMethod != NULL) {
2982+
j9mem_free_memory(stats->longestWaitMethod);
2983+
stats->longestWaitMethod = NULL;
29842984
}
29852985
}
29862986

0 commit comments

Comments
 (0)