@@ -417,6 +417,30 @@ public void shenandoah_232_Beginning() throws Exception {
417
417
is (1L ));
418
418
}
419
419
420
+ @ Test
421
+ public void serialPrintGCID () throws Exception {
422
+ TestLogHandler handler = new TestLogHandler ();
423
+ handler .setLevel (Level .WARNING );
424
+ GCResource gcResource = new GcResourceFile ("byteArray" );
425
+ gcResource .getLogger ().addHandler (handler );
426
+
427
+ ByteArrayInputStream in = new ByteArrayInputStream (
428
+ ("2022-08-01T17:14:32.660+0000: 0.177: #1: [GC (Allocation Failure) 2022-08-01T17:14:32.661+0000: 0.178: #1: [DefNew: 9766K->1056K(9792K), 0.0057621 secs] 16728K->16694K(31680K), 0.0073601 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] \n " +
429
+ "2022-08-01T17:14:32.671+0000: 0.188: #2: [GC (Allocation Failure) 2022-08-01T17:14:32.672+0000: 0.189: #2: [DefNew: 9746K->1056K(9792K), 0.0073505 secs]2022-08-01T17:14:32.680+0000: 0.197: #3: [Tenured: 24314K->24378K(24384K), 0.0036336 secs] 25384K->25370K(34176K), [Metaspace: 2712K->2712K(1056768K)], 0.0134215 secs] [Times: user=0.01 sys=0.00, real=0.02 secs] \n " )
430
+ .getBytes ());
431
+
432
+ DataReader reader = new DataReaderSun1_6_0 (gcResource , in , GcLogType .SUN1_8 );
433
+ GCModel model = reader .read ();
434
+
435
+ assertThat ("gc count" , model .size (), is (2 ));
436
+ assertThat ("warnings" , handler .getCount (), is (0 ));
437
+
438
+ AbstractGCEvent <?> secondEvent = model .get (1 );
439
+ assertThat ("name" , secondEvent .getTypeAsString (), equalTo ("GC (Allocation Failure); DefNew; Tenured; Metaspace" ));
440
+ assertThat ("duration" , secondEvent .getPause (), closeTo (0.0134215 , 0.0000001 ));
441
+ assertThat ("before" , secondEvent .getPreUsed (), is (25384 ));
442
+ }
443
+
420
444
@ Test
421
445
public void parallelPrintGCID () throws Exception {
422
446
TestLogHandler handler = new TestLogHandler ();
@@ -432,4 +456,24 @@ public void parallelPrintGCID() throws Exception {
432
456
assertEquals ("number of errors" , 0 , handler .getCount ());
433
457
}
434
458
459
+ @ Test
460
+ public void cmsPrintGCID () throws Exception {
461
+ TestLogHandler handler = new TestLogHandler ();
462
+ handler .setLevel (Level .WARNING );
463
+ GCResource gcResource = new GcResourceFile ("SampleSun1_8_0CmsPrintGcId.txt" );
464
+ gcResource .getLogger ().addHandler (handler );
465
+
466
+ DataReader reader = getDataReader (gcResource );
467
+ GCModel model = reader .read ();
468
+
469
+ assertThat ("gc count" , model .size (), is (18 ));
470
+ assertThat ("warnings" , handler .getCount (), is (0 ));
471
+
472
+ AbstractGCEvent <?> parnew = model .get (0 );
473
+ assertThat ("name" , parnew .getTypeAsString (), equalTo ("GC (Allocation Failure); ParNew" ));
474
+ assertThat ("duration" , parnew .getPause (), closeTo (0.0106548 , 0.0000001 ));
475
+ assertThat ("before" , parnew .getPreUsed (), is (8678 ));
476
+
477
+ }
478
+
435
479
}
0 commit comments