Search in sources :

Example 86 with GCModel

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

the class TestDataReaderSun1_6_0G1 method testDetailedCollectionMixed1.

@Test
public void testDetailedCollectionMixed1() throws Exception {
    // parse one detailed event with a mixed line (concurrent event starts in the middle of an stw collection)
    // 8.775: [GC pause (young)8.775: [GC concurrent-mark-end, 0.0101638 sec]
    // , 0.00831998 secs]
    String fileName = "SampleSun1_6_0G1_Detailed-mixedLine1.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("number of pauses", 1, model.getPause().getN());
    assertEquals("gc pause sum", 0.00831998, model.getPause().getSum(), 0.000000001);
    assertEquals("gc memory", 169 * 1024 - 162 * 1024, model.getFreedMemoryByGC().getMax());
}
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)

Example 87 with GCModel

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

the class TestDataReaderSun1_6_0G1 method testGcPattern.

@Test
public void testGcPattern() throws Exception {
    InputStream in = new ByteArrayInputStream(("0.452: [GC concurrent-count-start]").getBytes());
    DataReader reader = new DataReaderSun1_6_0G1(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6G1);
    GCModel model = reader.read();
    assertEquals("count", 1, model.size());
    assertEquals("full gc pause", 0, model.getFullGCPause().getN());
    assertEquals("gc pause", 0, model.getGCPause().getN());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) 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)

Example 88 with GCModel

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

the class TestDataReaderSun1_6_0G1 method testDetailedCollectionMixed3.

@Test
public void testDetailedCollectionMixed3() throws Exception {
    // parse one detailed event with a mixed line (part of concurrent event starts in the middle of an stw collection)
    // 0.331: [GC pause (young)0.333 (initial-mark), 0.00178520 secs]
    // :    [GC concurrent-mark-start]        
    String fileName = "SampleSun1_6_0G1_Detailed-mixedLine3.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.00178520, model.getPause().getSum(), 0.000000001);
}
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)

Example 89 with GCModel

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

the class TestDataReaderSun1_6_0G1 method initialMarkHeapAtGcMixed.

@Test
public void initialMarkHeapAtGcMixed() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleSun1_6_0G1InitialMarkMixed.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(2));
    assertThat("GC pause", model.getGCPause().getSum(), closeTo(0.03643900, 0.000000001));
    assertThat("heap size", model.getHeapAllocatedSizes().getMax(), is(10240 * 1024));
    assertThat("number of errors", handler.getCount(), is(0));
    assertThat("concurrent type name", model.getConcurrentGCEvents().next().getTypeAsString(), equalTo("GC concurrent-mark-start"));
}
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 90 with GCModel

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

the class TestDataReaderSun1_6_0G1 method testG1FullGcSystemGc.

@Test
public void testG1FullGcSystemGc() throws Exception {
    InputStream in = new ByteArrayInputStream(("9.978: [Full GC (System.gc()) 597M->1142K(7168K), 0.1604955 secs]").getBytes());
    DataReader reader = new DataReaderSun1_6_0G1(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6G1);
    GCModel model = reader.read();
    assertEquals("count", 1, model.size());
    assertEquals("full gc pause", 0.1604955, model.getFullGCPause().getMax(), 0.000001);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) 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

GCModel (com.tagtraum.perf.gcviewer.model.GCModel)167 Test (org.junit.Test)145 GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)133 ByteArrayInputStream (java.io.ByteArrayInputStream)89 GCEvent (com.tagtraum.perf.gcviewer.model.GCEvent)45 InputStream (java.io.InputStream)45 GCResource (com.tagtraum.perf.gcviewer.model.GCResource)40 AbstractGCEvent (com.tagtraum.perf.gcviewer.model.AbstractGCEvent)15 IOException (java.io.IOException)14 GcResourceSeries (com.tagtraum.perf.gcviewer.model.GcResourceSeries)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ArrayList (java.util.ArrayList)3 DoubleData (com.tagtraum.perf.gcviewer.math.DoubleData)2 StringTokenizer (java.util.StringTokenizer)2 Logger (java.util.logging.Logger)2 DataReaderException (com.tagtraum.perf.gcviewer.imp.DataReaderException)1 DataReaderFacade (com.tagtraum.perf.gcviewer.imp.DataReaderFacade)1 ConcurrentGCEvent (com.tagtraum.perf.gcviewer.model.ConcurrentGCEvent)1 VmOperationEvent (com.tagtraum.perf.gcviewer.model.VmOperationEvent)1 ModelChartImpl (com.tagtraum.perf.gcviewer.view.ModelChartImpl)1