|
1 | 1 | package com.tagtraum.perf.gcviewer.imp; |
2 | 2 |
|
| 3 | +import static org.hamcrest.Matchers.is; |
3 | 4 | import static org.junit.Assert.assertEquals; |
| 5 | +import static org.junit.Assert.assertThat; |
4 | 6 | import static org.junit.Assert.assertTrue; |
5 | 7 |
|
6 | 8 | import java.io.ByteArrayInputStream; |
@@ -862,4 +864,29 @@ public void testPromotionFailedWithReference() throws Exception { |
862 | 864 | assertEquals("main type", "GC--", model.get(0).getExtendedType().getName()); |
863 | 865 | assertEquals("detail type", "PSYoungGen", model.get(0).details().next().getExtendedType().getName()); |
864 | 866 | } |
| 867 | + |
| 868 | + @Test |
| 869 | + public void testCmsGcLocker() throws Exception { |
| 870 | + TestLogHandler handler = new TestLogHandler(); |
| 871 | + handler.setLevel(Level.WARNING); |
| 872 | + IMP_LOGGER.addHandler(handler); |
| 873 | + DATA_READER_FACTORY_LOGGER.addHandler(handler); |
| 874 | + |
| 875 | + ByteArrayInputStream in = new ByteArrayInputStream( |
| 876 | + ("2269.664: [CMS-concurrent-sweep-start]" |
| 877 | + + "\n2270.039: [GC 2270.039: [ParNew: 3686400K->3686400K(3686400K), 0.0000270 secs] 19876932K->19876932K(20070400K), 0.0000980 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]" |
| 878 | + + "\nGC locker: Trying a full collection because scavenge failed" |
| 879 | + + "\n2270.039: [Full GC 2270.039: [CMS2281.247: [CMS-concurrent-sweep: 11.558/11.583 secs] [Times: user=13.89 sys=0.08, real=11.58 secs]" |
| 880 | + + "\n (concurrent mode failure): 16190532K->14091936K(16384000K), 64.4965310 secs] 19876932K->14091936K(20070400K), [CMS Perm : 111815K->111803K(262144K)], 64.4966380 secs] [Times: user=64.41 sys=0.00, real=64.50 secs]" |
| 881 | + + "\n2334.567: [GC [1 CMS-initial-mark: 14091936K(16384000K)] 14164705K(20070400K), 0.0180200 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]" |
| 882 | + + "\n2334.587: [CMS-concurrent-mark-start]" |
| 883 | + ).getBytes()); |
| 884 | + |
| 885 | + final DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_6); |
| 886 | + GCModel model = reader.read(); |
| 887 | + |
| 888 | + assertThat("count", model.size(), is(6)); |
| 889 | + assertThat("parse warning count", handler.getCount(), is(0)); |
| 890 | + } |
| 891 | + |
865 | 892 | } |
0 commit comments