@@ -170,7 +170,6 @@ private static void checkExpectedLogMessages(OutputAnalyzer output, boolean expe
170
170
if (expectEnabled ) {
171
171
output .shouldContain ("Periodic native trim enabled (interval: " + expectedInterval + " ms" );
172
172
output .shouldContain ("Native heap trimmer start" );
173
- output .shouldContain ("Native heap trimmer stop" );
174
173
} else {
175
174
output .shouldNotContain ("Periodic native trim enabled" );
176
175
}
@@ -251,7 +250,7 @@ public static void main(String[] args) throws Exception {
251
250
System .gc ();
252
251
253
252
// give GC time to react
254
- System .out .println ("Sleeping..." );
253
+ System .out .println ("Sleeping for " + sleeptime + " ms ..." );
255
254
Thread .sleep (sleeptime );
256
255
System .out .println ("Done." );
257
256
}
@@ -296,12 +295,15 @@ public static void main(String[] args) throws Exception {
296
295
297
296
case "trimNativeLowInterval" :
298
297
case "trimNativeLowIntervalStrict" : {
298
+ long ms1 = System .currentTimeMillis ();
299
299
OutputAnalyzer output = runTestWithOptions (
300
300
new String [] { "-XX:+UnlockExperimentalVMOptions" , "-XX:TrimNativeHeapInterval=1" },
301
301
new String [] { TestTrimNative .Tester .class .getName (), "0" }
302
302
);
303
+ long ms2 = System .currentTimeMillis ();
304
+ int maxTrimsExpected = (int )(ms2 - ms1 ); // 1ms trim interval
303
305
checkExpectedLogMessages (output , true , 1 );
304
- parseOutputAndLookForNegativeTrim (output , 1 , 3000 , strictTesting );
306
+ parseOutputAndLookForNegativeTrim (output , 1 , ( int ) maxTrimsExpected , strictTesting );
305
307
} break ;
306
308
307
309
case "testOffOnNonCompliantPlatforms" : {
0 commit comments