@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()); }
/** * Often only the young generation information is explicitly present. Old generation memory size * can be derived from heap - young size. This test checks for presence of derived memory * information. */ @Test public void testDerivedGenerationValues() throws Exception { ByteArrayInputStream in = new ByteArrayInputStream( "10.675: [GC [PSYoungGen: 21051K->4947K(22656K)] 23342K->7238K(67712K), 0.0191817 secs] [Times: user=0.09 sys=0.01, real=0.02 secs]" .getBytes()); final DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_6); GCModel model = reader.read(); assertEquals("GC count", 1, model.size()); assertEquals("young used", 21051, model.getYoungUsedSizes().getMin()); assertEquals("young allocated", 22656, model.getYoungAllocatedSizes().getMax()); assertEquals("tenured used", 23342 - 21051, model.getTenuredUsedSizes().getMin()); assertEquals("tenured allocated", 67712 - 22656, model.getTenuredAllocatedSizes().getMax()); }