@@ -2920,6 +2920,10 @@ JavaCoreDumpWriter::writeHookSection(void)
29202920void
29212921JavaCoreDumpWriter::writeSynchronousCompilationSection (void )
29222922{
2923+ char timeStamp[_MaximumTimeStampLength + 1 ];
2924+ PORT_ACCESS_FROM_PORT (_PortLibrary);
2925+ OMRPORT_ACCESS_FROM_J9PORT (PORTLIB );
2926+
29232927 J9JITConfig *jitConfig = _VirtualMachine->jitConfig ;
29242928 if (NULL == jitConfig || NULL == jitConfig->syncCompStats ) {
29252929 return ;
@@ -2936,41 +2940,61 @@ JavaCoreDumpWriter::writeSynchronousCompilationSection(void)
29362940 _OutputStream.writeCharacters (" 2JITSYNCCOUNT Total synchronous compilations: " );
29372941 _OutputStream.writeInteger (stats->totalCount , " %u" );
29382942 _OutputStream.writeCharacters (" \n " );
2939- _OutputStream.writeCharacters (" 2JITTOTALWAIT Total application wait time (JVM uptime us) : " );
2943+ _OutputStream.writeCharacters (" 2JITTOTALWAIT Total application wait time: " );
29402944 _OutputStream.writeInteger (stats->totalWaitTime , " %llu" );
29412945 _OutputStream.writeCharacters (" us\n " );
2942- if (stats->longestWaitTime != 0 ) {
2943- _OutputStream.writeCharacters (" 2JITLONGEST Longest Synchronous Compilation\n " );
2946+ for (int i = 0 ; i < J9_LONGEST_SYNC_COMP ; i++) {
2947+ if (stats->longestWaitMethods [i].waitTime == 0 || stats->longestWaitMethods [i].method == NULL )
2948+ break ;
2949+ _OutputStream.writeCharacters (" 2JITLONGEST " );
2950+ if (i == 0 ) {
2951+ _OutputStream.writeCharacters (" Longest" );
2952+ }
2953+ else if (i == 1 ) {
2954+ _OutputStream.writeCharacters (" 2nd Longest" );
2955+ }
2956+ else {
2957+ _OutputStream.writeCharacters (" 3rd Longest" );
2958+ }
2959+ _OutputStream.writeCharacters (" Synchronous Compilation\n " );
2960+
29442961 _OutputStream.writeCharacters (" 3JITWAITTIME Wait time: " );
2945- _OutputStream.writeInteger (stats->longestWaitTime , " %llu" );
2962+ _OutputStream.writeInteger (stats->longestWaitMethods [i]. waitTime , " %llu" );
29462963 _OutputStream.writeCharacters (" us\n " );
29472964
2948- _OutputStream.writeCharacters (" 3JITSTARTTIME Wait time start (JVM uptime us): " );
2949- _OutputStream.writeInteger64 (stats->longestWaitTimeStart , " %llu" );
2950- _OutputStream.writeCharacters (" us\n " );
2965+ _OutputStream.writeCharacters (" 3JITENDTIME Wait time end: " );
2966+ omrstr_ftime_ex (timeStamp, _MaximumTimeStampLength, " %Y-%m-%dT%H:%M:%S" ,
2967+ stats->longestWaitMethods [i].waitTimeEnd , OMRSTR_FTIME_FLAG_LOCAL );
2968+ timeStamp[_MaximumTimeStampLength] = ' \0 ' ;
2969+ _OutputStream.writeCharacters (timeStamp);
2970+ _OutputStream.writeInteger64 (stats->longestWaitMethods [i].waitTimeEnd % 1000 , " .%03llu" );
2971+ _OutputStream.writeCharacters (" \n " );
29512972
2952- _OutputStream.writeCharacters (" 3JITENDTIME Wait time end (JVM uptime us) : " );
2953- _OutputStream.writeInteger64 (stats->longestWaitTimeEnd , " %llu " );
2954- _OutputStream.writeCharacters (" us \n " );
2973+ _OutputStream.writeCharacters (" 3JITMETHOD Method : " );
2974+ _OutputStream.writeCharacters (stats->longestWaitMethods [i]. method );
2975+ _OutputStream.writeCharacters (" \n " );
29552976
2956- if (stats->longestWaitMethod != NULL ) {
2957- _OutputStream.writeCharacters (" 3JITMETHOD Method : " );
2958- _OutputStream.writeCharacters (stats->longestWaitMethod );
2977+ if (stats->longestWaitMethods [i]. thread != NULL ) {
2978+ _OutputStream.writeCharacters (" 3JITTHREAD Thread : " );
2979+ _OutputStream.writeCharacters (stats->longestWaitMethods [i]. thread );
29592980 _OutputStream.writeCharacters (" \n " );
29602981 }
2961-
29622982 }
29632983
29642984 stats->totalCount = 0 ;
29652985 stats->totalWaitTime = 0 ;
2966- stats->longestWaitTime = 0 ;
2967- stats->longestWaitTimeStart = 0 ;
2968- stats->longestWaitTimeEnd = 0 ;
2969- if (stats->longestWaitMethod != NULL ) {
2970- PORT_ACCESS_FROM_PORT (_PortLibrary);
2971- j9mem_free_memory (stats->longestWaitMethod );
2972- stats->longestWaitMethod = NULL ;
2973- }
2986+ for (int i = 0 ; i < J9_LONGEST_SYNC_COMP ; i++) {
2987+ stats->longestWaitMethods [i].waitTime = 0 ;
2988+ stats->longestWaitMethods [i].waitTimeEnd = 0 ;
2989+ if (stats->longestWaitMethods [i].method != NULL ) {
2990+ j9mem_free_memory (stats->longestWaitMethods [i].method );
2991+ stats->longestWaitMethods [i].method = NULL ;
2992+ }
2993+ if (stats->longestWaitMethods [i].thread != NULL ) {
2994+ j9mem_free_memory (stats->longestWaitMethods [i].thread );
2995+ stats->longestWaitMethods [i].thread = NULL ;
2996+ }
2997+ }
29742998}
29752999
29763000#if defined(OMR_OPT_CUDA)
0 commit comments