@Test public void testCmsMemory() throws Exception { final InputStream in = getClass().getResourceAsStream("SampleSun1_6_0CMS.txt"); final DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_6); GCModel model = reader.read(); assertEquals("GC count", 41, model.size()); assertEquals("heap min allocated", 249088, model.getHeapAllocatedSizes().getMin()); assertEquals("heap max allocated", 249088, model.getHeapAllocatedSizes().getMax()); assertEquals("young min allocated", 118016, model.getYoungAllocatedSizes().getMin()); assertEquals("young max allocated", 118016, model.getYoungAllocatedSizes().getMax()); assertEquals("tenured min allocated", 131072, model.getTenuredAllocatedSizes().getMin()); assertEquals("tenured max allocated", 131072, model.getTenuredAllocatedSizes().getMax()); assertEquals("perm min allocated", 21248, model.getPermAllocatedSizes().getMin()); assertEquals("perm max allocated", 21248, model.getPermAllocatedSizes().getMax()); assertEquals("heap min used", 80841, model.getHeapUsedSizes().getMin()); assertEquals("heap max used", 209896, model.getHeapUsedSizes().getMax()); assertEquals("young min used", 15160, model.getYoungUsedSizes().getMin()); assertEquals("young max used", 118010, model.getYoungUsedSizes().getMax()); assertEquals("tenured min used", 0, model.getTenuredUsedSizes().getMin()); assertEquals("tenured max used", 115034, model.getTenuredUsedSizes().getMax()); assertEquals("perm min used", 2560, model.getPermUsedSizes().getMin()); assertEquals("perm max used", 2561, model.getPermUsedSizes().getMax()); assertEquals("promotion avg", 16998.3846, model.getPromotion().average(), 0.0001); assertEquals("promotion total", 220979, model.getPromotion().getSum()); }
@Test public void testPrintTenuringDistribution() throws Exception { ByteArrayInputStream in = new ByteArrayInputStream( ("2011-02-14T13:15:24.164+0100: 31581.748: [GC 31581.748: [ParNew" + "\nDesired survivor size 5963776 bytes, new threshold 1 (max 4)" + "\n- age 1: 8317928 bytes, 8317928 total" + "\n: 92938K->8649K(104832K), 0.0527364 secs] 410416K->326127K(1036928K), 0.0533874 secs] [Times: user=0.46 sys=0.09, real=0.05 secs]") .getBytes()); final DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_6); GCModel model = reader.read(); assertEquals("GC count", 1, model.size()); assertEquals("event pause", 0.0533874, model.getGCPause().getMax(), 0.0000001); assertEquals("promotion", 0, model.getPromotion().getMax()); }
@Test public void testMixedLineWithEmptyLine() throws Exception { ByteArrayInputStream in = new ByteArrayInputStream( ("2011-01-25T17:10:16.889+0100: 12076.859: [GC 12076.859: [ParNew2011-01-25T17:10:16.896+0100: 12076.866: [CMS-concurrent-abortable-preclean: 0.929/4.899 secs] [Times: user=2.13 sys=0.04, real=4.90 secs]" + "\n" + "\nDesired survivor size 720896 bytes, new threshold 1 (max 4)" + "\n- age 1: 1058016 bytes, 1058016 total" + "\n: 13056K->1408K(13056K), 0.0128277 secs] 131480K->122757K(141328K), 0.0131346 secs] [Times: user=0.15 sys=0.00, real=0.01 secs]") .getBytes()); final DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_6); GCModel model = reader.read(); assertEquals("GC count", 2, model.size()); assertEquals("event pause", 0.0131346, model.getGCPause().getMax(), 0.0000001); assertEquals("promotion", 2925, model.getPromotion().getMax()); }