Skip to content

Commit 3ffce49

Browse files
committed
recent updates
1 parent 177844e commit 3ffce49

3 files changed

Lines changed: 37 additions & 63 deletions

File tree

runtime/compiler/control/CompilationThread.cpp

Lines changed: 21 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 waitStartElapsedTime = 0;
6174+
PORT_ACCESS_FROM_JITCONFIG(_jitConfig);
61736175
if (!async) {
6174-
waitStart = getPersistentInfo()->getElapsedTime();
6176+
waitStart = j9time_hires_clock();
6177+
waitStartElapsedTime = getPersistentInfo()->getElapsedTime();
61756178
}
61766179

61776180
// Release the compilation monitor
@@ -6272,56 +6275,37 @@ 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 = waitStartElapsedTime * 1000;
6287+
_syncCompStats.longestWaitTimeEnd = (waitStartElapsedTime * 1000) + duration;
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),
6304+
J9UTF8_DATA(className), J9UTF8_LENGTH(name), J9UTF8_DATA(name), J9UTF8_LENGTH(signature),
6305+
J9UTF8_DATA(signature));
63226306
}
63236307

6324-
_syncCompStats.longestWaitMethodInfo = tempLongestWaitMethodInfo;
6308+
_syncCompStats.longestWaitMethod = templongestWaitMethod;
63256309
}
63266310
}
63276311

runtime/oti/j9nonbuilder.h

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

43234323
typedef struct J9JITSyncCompilationStatistics {
4324+
/* All times are in microseconds (us) */
43244325
uint32_t totalCount;
43254326
uint64_t totalWaitTime;
43264327
uint64_t longestWaitTime;
43274328
uint64_t longestWaitTimeStart;
43284329
uint64_t longestWaitTimeEnd;
4329-
char* longestWaitMethodInfo;
4330+
char* longestWaitMethod;
43304331
} J9JITSyncCompilationStatistics;
43314332

43324333
/* @ddr_namespace: map_to_type=J9JITConfig */

runtime/rasdump/javadump.cpp

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,15 +2920,14 @@ JavaCoreDumpWriter::writeHookSection(void)
29202920
void
29212921
JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29222922
{
2923-
29242923
J9JITConfig *jitConfig = _VirtualMachine->jitConfig;
29252924
if (NULL == jitConfig || NULL == jitConfig->syncCompStats) {
29262925
return;
29272926
}
29282927

29292928
J9JITSyncCompilationStatistics *stats = jitConfig->syncCompStats;
29302929

2931-
_OutputStream.writeCharacters("0SECTION Synchronous compilations info dump routine\n\n");
2930+
_OutputStream.writeCharacters("0SECTION Synchronous compilations info dump routine\n");
29322931
_OutputStream.writeCharacters("NULL ==============================\n");
29332932
_OutputStream.writeCharacters("1NOTE This data is reset after each javacore file is written\n");
29342933
_OutputStream.writeCharacters("NULL ------------------------------------------------------------------------\n");
@@ -2937,36 +2936,26 @@ JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29372936
_OutputStream.writeCharacters("2JITSYNCCOUNT Total synchronous compilations: ");
29382937
_OutputStream.writeInteger(stats->totalCount, "%u");
29392938
_OutputStream.writeCharacters("\n");
2940-
_OutputStream.writeCharacters("2JITTOTALWAIT Total application wait time (JVM uptime ms): ");
2939+
_OutputStream.writeCharacters("2JITTOTALWAIT Total application wait time (JVM uptime us): ");
29412940
_OutputStream.writeInteger(stats->totalWaitTime, "%llu");
2942-
_OutputStream.writeCharacters("ms\n");
2941+
_OutputStream.writeCharacters("us\n");
29432942
if (stats->longestWaitTime != 0) {
29442943
_OutputStream.writeCharacters("2JITLONGEST Longest Synchronous Compilation\n");
29452944
_OutputStream.writeCharacters("3JITWAITTIME Wait time: ");
29462945
_OutputStream.writeInteger(stats->longestWaitTime, "%llu");
2947-
_OutputStream.writeCharacters("ms\n");
2946+
_OutputStream.writeCharacters("us\n");
29482947

2949-
_OutputStream.writeCharacters("3JITSTARTTIME Wait time start (JVM uptime ms): ");
2948+
_OutputStream.writeCharacters("3JITSTARTTIME Wait time start (JVM uptime us): ");
29502949
_OutputStream.writeInteger64(stats->longestWaitTimeStart, "%llu");
2951-
_OutputStream.writeCharacters("ms\n");
2950+
_OutputStream.writeCharacters("us\n");
29522951

2953-
_OutputStream.writeCharacters("3JITENDTIME Wait time end (JVM uptime ms): ");
2952+
_OutputStream.writeCharacters("3JITENDTIME Wait time end (JVM uptime us): ");
29542953
_OutputStream.writeInteger64(stats->longestWaitTimeEnd, "%llu");
2955-
_OutputStream.writeCharacters("ms\n");
2956-
2957-
if (stats->longestWaitMethodInfo != NULL) {
2958-
char *className = stats->longestWaitMethodInfo;
2959-
char *name = className + strlen(className) + 1;
2960-
char *signature = name + strlen(name) + 1;
2954+
_OutputStream.writeCharacters("us\n");
29612955

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);
2956+
if (stats->longestWaitMethod != NULL) {
2957+
_OutputStream.writeCharacters("3JITMETHOD Method: ");
2958+
_OutputStream.writeCharacters(stats->longestWaitMethod);
29702959
_OutputStream.writeCharacters("\n");
29712960
}
29722961

@@ -2977,10 +2966,10 @@ JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29772966
stats->longestWaitTime = 0;
29782967
stats->longestWaitTimeStart = 0;
29792968
stats->longestWaitTimeEnd = 0;
2980-
if (stats->longestWaitMethodInfo != NULL) {
2969+
if (stats->longestWaitMethod != NULL) {
29812970
PORT_ACCESS_FROM_PORT(_PortLibrary);
2982-
j9mem_free_memory(stats->longestWaitMethodInfo);
2983-
stats->longestWaitMethodInfo = NULL;
2971+
j9mem_free_memory(stats->longestWaitMethod);
2972+
stats->longestWaitMethod = NULL;
29842973
}
29852974
}
29862975

0 commit comments

Comments
 (0)