Search in sources :

Example 11 with GcResourceFile

use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.

the class TestDataReaderSun1_6_0 method testCMSScavengeBeforeRemarkTimeStamp.

@Test
public void testCMSScavengeBeforeRemarkTimeStamp() throws Exception {
    ByteArrayInputStream in = new ByteArrayInputStream(("2.036: [GC[YG occupancy: 235954 K (235968 K)]2.036: [GC 2.036: [ParNew: 235954K->30K(235968K), 0.0004961 secs] 317153K->81260K(395712K), 0.0005481 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]" + "\n2.037: [Rescan (parallel) , 0.0002425 secs]2.037: [weak refs processing, 0.0000041 secs]2.037: [class unloading, 0.0000938 secs]2.037: [scrub symbol & string tables, 0.0003138 secs] [1 CMS-remark: 81230K(159744K)] 81260K(395712K), 0.0013653 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]").getBytes());
    DataReader reader = new DataReaderSun1_6_0(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6);
    GCModel model = reader.read();
    assertEquals("GC count", 2, model.size());
    assertEquals("1st event", "GC; ParNew", model.get(0).getTypeAsString());
    assertEquals("2nd event", "GC; CMS-remark", model.get(1).getTypeAsString());
    assertEquals("1st event pause", 0.0005481, ((GCEvent) model.get(0)).getPause(), 0.00000001);
    assertEquals("2nd event pause", 0.0013653 - 0.0005481, ((GCEvent) model.get(1)).getPause(), 0.00000001);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 12 with GcResourceFile

use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.

the class TestDataReaderSun1_6_0 method testCMSAdaptiveSizePolicyPrintHeapAtGC.

@Test
public void testCMSAdaptiveSizePolicyPrintHeapAtGC() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("byteArray");
    gcResource.getLogger().addHandler(handler);
    ByteArrayInputStream in = new ByteArrayInputStream(("2012-04-18T14:48:31.855+0200: 29.592: [GC 29.592: [ASParNew: 52825K->6499K(59008K), 0.0268761 secs] 120805K->120749K(517760K), 0.0269605 secs] [Times: user=0.05 sys=0.00, real=0.03 secs]" + "\nHeap" + "\nadaptive size par new generation total 59008K, used 15368K [0x00000000d8000000, 0x00000000dc000000, 0x00000000dc000000)" + "\n eden space 52480K,  16% used [0x00000000d8000000, 0x00000000d88a95a0, 0x00000000db340000)" + "\n from space 6528K,  99% used [0x00000000db340000, 0x00000000db998cb0, 0x00000000db9a0000)" + "\n to   space 6528K,   0% used [0x00000000db9a0000, 0x00000000db9a0000, 0x00000000dc000000)" + "\nconcurrent mark-sweep generation total 458752K, used 259541K [0x00000000dc000000, 0x00000000f8000000, 0x00000000f8000000)" + "\nconcurrent-mark-sweep perm gen total 65536K, used 2621K [0x00000000f8000000, 0x00000000fc000000, 0x0000000100000000)").getBytes());
    DataReader reader = new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_6);
    GCModel model = reader.read();
    assertEquals("GC count", 1, model.size());
    assertEquals("GC pause", 0.0269605, model.getGCPause().getMin(), 0.000000001);
    assertEquals("number of errors", 0, handler.getCount());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 13 with GcResourceFile

use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.

the class TestDataReaderSun1_6_0 method testCmsInitiatingOccupancyFraction.

@Test
public void testCmsInitiatingOccupancyFraction() throws Exception {
    ByteArrayInputStream in = new ByteArrayInputStream(("12460.657: [GC [1 CMS-initial-mark: 789976K(1572864K)] 838178K(2044736K), 0.3114519 secs] [Times: user=0.32 sys=0.00, real=0.31 secs]").getBytes());
    DataReader reader = new DataReaderSun1_6_0(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6);
    GCModel model = reader.read();
    assertEquals("GC count", 1, model.size());
    assertEquals("iof", 0.5022532145182292, model.getCmsInitiatingOccupancyFraction().average(), 0.0000001);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 14 with GcResourceFile

use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.

the class TestDataReaderSun1_6_0G1 method printHeapAtGcPrintTenuringDistributionFullGc.

@Test
public void printHeapAtGcPrintTenuringDistributionFullGc() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleSun1_6_0G1FullGcTenuringDistribution.txt");
    gcResource.getLogger().addHandler(handler);
    InputStream in = getInputStream(gcResource.getResourceName());
    DataReader reader = new DataReaderSun1_6_0G1(gcResource, in, GcLogType.SUN1_6G1);
    GCModel model = reader.read();
    assertThat("GC count", model.size(), is(1));
    assertThat("GC pause", model.getFullGCPause().getSum(), closeTo(37.0629320, 0.000000001));
    assertThat("heap size", model.getHeapAllocatedSizes().getMax(), is(10240 * 1024));
    assertThat("number of errors", handler.getCount(), is(0));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 15 with GcResourceFile

use of com.tagtraum.perf.gcviewer.model.GcResourceFile in project GCViewer by chewiebug.

the class TestDataReaderSun1_6_0G1 method testPartialToSpaceOverflowInitialMark.

@Test
public void testPartialToSpaceOverflowInitialMark() throws Exception {
    // special type of GC: 0.838: "[GC pause (partial) (to-space overflow) (initial-mark)..."
    String fileName = "SampleSun1_6_0G1_partial_initialMarkToSpaceOverflow.txt";
    InputStream in = getInputStream(fileName);
    DataReader reader = new DataReaderSun1_6_0G1(new GcResourceFile(fileName), in, GcLogType.SUN1_6G1);
    GCModel model = reader.read();
    assertEquals("nummber of events", 2, model.size());
    assertEquals("concurrent event type", Type.G1_CONCURRENT_MARK_START.toString(), model.getConcurrentGCEvents().next().getTypeAsString());
    assertEquals("number of pauses", 1, model.getPause().getN());
    assertEquals("gc pause sum", 0.00588343, model.getPause().getSum(), 0.000000001);
    assertEquals("gc memory", 255 * 1024 - 197 * 1024, model.getFreedMemoryByGC().getMax());
    assertEquals("max memory", 256 * 1024, model.getFootprint());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Aggregations

GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)186 Test (org.junit.Test)178 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)133 ByteArrayInputStream (java.io.ByteArrayInputStream)118 InputStream (java.io.InputStream)69 GCResource (com.tagtraum.perf.gcviewer.model.GCResource)55 GCEvent (com.tagtraum.perf.gcviewer.model.GCEvent)21 GcResourceSeries (com.tagtraum.perf.gcviewer.model.GcResourceSeries)11 File (java.io.File)8 ArrayList (java.util.ArrayList)6 GCViewerGuiController (com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController)2 AbstractGCEvent (com.tagtraum.perf.gcviewer.model.AbstractGCEvent)2 LogRecord (java.util.logging.LogRecord)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)2 GCModelLoader (com.tagtraum.perf.gcviewer.ctrl.GCModelLoader)1 DataReader (com.tagtraum.perf.gcviewer.imp.DataReader)1 DataReaderFactory (com.tagtraum.perf.gcviewer.imp.DataReaderFactory)1 DoubleData (com.tagtraum.perf.gcviewer.math.DoubleData)1 IntData (com.tagtraum.perf.gcviewer.math.IntData)1