@@ -1822,18 +1822,37 @@ processContinuationCacheOptions(J9JavaVM *vm)
1822
1822
IDATA argIndex = FIND_AND_CONSUME_VMARG (STARTSWITH_MATCH , VMOPT_XXCONTINUATIONCACHE , NULL );
1823
1823
if (-1 != argIndex ) {
1824
1824
char * cursor = NULL ;
1825
+ char * scanEnd = NULL ;
1825
1826
U_32 cacheSize = 0 ;
1827
+
1826
1828
GET_OPTION_OPTION (argIndex , ':' , ':' , & cursor );
1829
+ scanEnd = cursor + strlen (cursor );
1827
1830
1828
- if (try_scan (& cursor , "t1=" ) && (0 == omr_scan_u32 (& cursor , & cacheSize ))) {
1829
- vm -> continuationT1Size = cacheSize ;
1831
+ while (cursor < scanEnd ) {
1832
+ if (try_scan (& cursor , "t1=" ) && (0 == omr_scan_u32 (& cursor , & cacheSize ))) {
1833
+ vm -> continuationT1Size = cacheSize ;
1830
1834
1831
- if (try_scan (& cursor , ",t2=" ) && (0 == omr_scan_u32 (& cursor , & cacheSize ))){
1832
- vm -> continuationT2Size = cacheSize ;
1835
+ if (try_scan (& cursor , ",t2=" ) && (0 == omr_scan_u32 (& cursor , & cacheSize ))){
1836
+ vm -> continuationT2Size = cacheSize ;
1837
+ rc = 0 ;
1838
+ }
1839
+ } else if (try_scan (& cursor , "printSummary" )) {
1840
+ /* Set VM flag. */
1841
+ vm -> extendedRuntimeFlags2 |= J9_EXTENDED_RUNTIME2_ENABLE_CONTINUATION_CACHE_SUMMARY ;
1833
1842
rc = 0 ;
1843
+ } else {
1844
+ rc = -1 ;
1845
+ break ;
1846
+ }
1847
+
1848
+ /* Skip ',' delimiter. */
1849
+ if (',' == * cursor ) {
1850
+ cursor ++ ;
1834
1851
}
1835
1852
}
1836
- } else {
1853
+ }
1854
+ /* Set default cache size. */
1855
+ if (0 == vm -> continuationT1Size ) {
1837
1856
PORT_ACCESS_FROM_JAVAVM (vm );
1838
1857
vm -> continuationT1Size = 1 ;
1839
1858
vm -> continuationT2Size = (U_32 )(j9sysinfo_get_number_CPUs_by_type (J9PORT_CPU_TARGET ) * 2 );
@@ -6530,22 +6549,32 @@ runExitStages(J9JavaVM* vm, J9VMThread* vmThread)
6530
6549
}
6531
6550
}
6532
6551
#endif
6533
-
6534
- #if defined(J9VM_PROF_CONTINUATION_ALLOCATION )
6535
- if (0 < (vm -> t1CacheHit + vm -> t2CacheHit + vm -> fastAlloc + vm -> slowAlloc )) {
6552
+ #if JAVA_SPEC_VERSION >= 19
6553
+ if (J9_ARE_ANY_BITS_SET (vm -> extendedRuntimeFlags2 , J9_EXTENDED_RUNTIME2_ENABLE_CONTINUATION_CACHE_SUMMARY )
6554
+ && (0 < (vm -> t1CacheHit + vm -> t2CacheHit + vm -> cacheMiss ))
6555
+ ) {
6536
6556
PORT_ACCESS_FROM_JAVAVM (vm );
6537
- j9tty_printf (PORTLIB , "\nTotal Continuation entries: %u\n" , vm -> t1CacheHit + vm -> t2CacheHit + vm -> fastAlloc + vm -> slowAlloc );
6557
+ j9tty_printf (PORTLIB , "\nContinuation Cache Summary:" );
6558
+ j9tty_printf (PORTLIB , "\n T1 size: %u T2 size: %u\n" , vm -> continuationT1Size , vm -> continuationT2Size );
6559
+ j9tty_printf (PORTLIB , "\nTotal Continuation entries: %u\n" , vm -> t1CacheHit + vm -> t2CacheHit + vm -> cacheMiss );
6538
6560
j9tty_printf (PORTLIB , "\nCache Hits: %u" , vm -> t1CacheHit + vm -> t2CacheHit );
6539
6561
j9tty_printf (PORTLIB , "\n T1 Cache Hits: %u" , vm -> t1CacheHit );
6540
6562
j9tty_printf (PORTLIB , "\n T2 Cache Hits: %u" , vm -> t2CacheHit );
6541
- j9tty_printf (PORTLIB , "\nCache Miss: %u" , vm -> fastAlloc + vm -> slowAlloc );
6563
+ j9tty_printf (PORTLIB , "\nCache Miss: %u" , vm -> cacheMiss );
6564
+ #if defined(J9VM_PROF_CONTINUATION_ALLOCATION )
6542
6565
j9tty_printf (PORTLIB , "\n Fast Alloc (<10000ns): %u" , vm -> fastAlloc );
6543
- j9tty_printf (PORTLIB , "\n Avg Fast Alloc Time: %lldns " , (vm -> fastAlloc > 0 ? (vm -> fastAllocAvgTime / (I_64 )vm -> fastAlloc ) : 0 ));
6566
+ j9tty_printf (PORTLIB , "\n Avg Fast Alloc Time: %lld ns " , (vm -> fastAlloc > 0 ? (vm -> fastAllocAvgTime / (I_64 )vm -> fastAlloc ) : 0 ));
6544
6567
j9tty_printf (PORTLIB , "\n Slow Alloc (>10000ns): %u" , vm -> slowAlloc );
6545
- j9tty_printf (PORTLIB , "\n Avg Slow Alloc Time: %lldns" , (vm -> slowAlloc > 0 ? (vm -> slowAllocAvgTime / (I_64 )vm -> slowAlloc ) : 0 ));
6546
- j9tty_printf (PORTLIB , "\nAvg Cache Lookup Time: %lldns\n" , (vm -> avgCacheLookupTime / (I_64 )(vm -> t1CacheHit + vm -> t2CacheHit + vm -> fastAlloc + vm -> slowAlloc )));
6547
- }
6568
+ j9tty_printf (PORTLIB , "\n Avg Slow Alloc Time: %lld ns" , (vm -> slowAlloc > 0 ? (vm -> slowAllocAvgTime / (I_64 )vm -> slowAlloc ) : 0 ));
6569
+ j9tty_printf (PORTLIB , "\nAvg Cache Lookup Time: %lld ns" , (vm -> avgCacheLookupTime / (I_64 )(vm -> t1CacheHit + vm -> t2CacheHit + vm -> fastAlloc + vm -> slowAlloc )));
6548
6570
#endif /* defined(J9VM_PROF_CONTINUATION_ALLOCATION) */
6571
+ j9tty_printf (PORTLIB , "\n\nCache store: %u" , vm -> t1CacheHit + vm -> t2CacheHit + vm -> cacheMiss - vm -> cacheFree );
6572
+ j9tty_printf (PORTLIB , "\n T1 Cache store: %u" , vm -> t1CacheHit + vm -> t2CacheHit + vm -> cacheMiss - vm -> cacheFree - vm -> t2store );
6573
+ j9tty_printf (PORTLIB , "\n T2 Cache store: %u" , vm -> t2store );
6574
+ j9tty_printf (PORTLIB , "\nCache Freed: %u\n" , vm -> cacheFree );
6575
+ j9tty_printf (PORTLIB , "\nAvg Cache Stack Size: %.2f KB\n" , (double )vm -> totalContinuationStackSize / (vm -> t1CacheHit + vm -> t2CacheHit + vm -> cacheMiss ) / 1024 );
6576
+ }
6577
+ #endif /* JAVA_SPEC_VERSION >= 19 */
6549
6578
6550
6579
/* Unload before trace engine exits */
6551
6580
UT_MODULE_UNLOADED (J9_UTINTERFACE_FROM_VM (vm ));
0 commit comments