Search in sources :

Example 21 with GCEvent

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

the class TestDataReaderSun1_8_0G1 method fullGcWithDetailedSizes.

/**
     * In java 8, suddenly the full gc events in G1 got detailed information about the generation
     * sizes again. Test, that they are parsed correctly.
     */
@Test
public void fullGcWithDetailedSizes() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("byteArray");
    ByteArrayInputStream in = new ByteArrayInputStream(("2014-07-24T13:49:45.090+0400: 92457.841: [Full GC (Allocation Failure)  5811M->3097M(12G), 8.9862292 secs]" + "\n  [Eden: 4096.0K(532.0M)->0.0B(612.0M) Survivors: 80.0M->0.0B Heap: 5811.9M(12.0G)->3097.8M(12.0G)], [Metaspace: 95902K->95450K(1140736K)]" + "\n [Times: user=12.34 sys=0.22, real=8.99 secs]").getBytes());
    DataReader reader = new DataReaderSun1_6_0G1(gcResource, in, GcLogType.SUN1_8);
    GCModel model = reader.read();
    GCEvent event = (GCEvent) model.get(0);
    assertThat("footprint", event.getTotal(), is(12 * 1024 * 1024));
    assertThat("yound before", event.getYoung().getPreUsed(), is(4096 + 80 * 1024));
    assertThat("tenured", event.getTenured().getTotal(), is(12 * 1024 * 1024 - 612 * 1024));
    assertThat("metaspace", event.getPerm().getTotal(), is(1140736));
    assertThat("perm", model.getPermAllocatedSizes().getN(), is(1));
    assertThat("warning count", handler.getCount(), is(0));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 22 with GCEvent

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

the class TestGCResourceGroup method setup.

@Before
public void setup() {
    GCResource gcResource1 = new GcResourceFile("gcResource1");
    gcResource1.getModel().add(new GCEvent(1.1, 100, 50, 200, 0.003, Type.GC));
    GCResource gcResource2 = new GcResourceFile("gcResource2");
    gcResource2.getModel().add(new GCEvent(1.5, 1000, 400, 2000, 0.044, Type.FULL_GC));
    gcResourceList = new ArrayList<>();
    gcResourceList.add(gcResource1);
    gcResourceList.add(gcResource2);
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) Before(org.junit.Before)

Example 23 with GCEvent

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

the class TestDataReaderJRockit1_5_0 method testSimpleOpts.

@Test
public void testSimpleOpts() throws Exception {
    DataReader reader = getDataReader1_5(new GcResourceFile("SampleJRockit1_5_12-gcreport-simpleopts-singlecon.txt"));
    GCModel model = reader.read();
    assertEquals("count", 5, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 6.771, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 3145728, event.getPreUsed());
    assertEquals("after", 296406, event.getPostUsed());
    assertEquals("total", 3145728, event.getTotal());
    assertEquals("pause", 0.066, event.getPause(), 0.0000001);
}
Also used : GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 24 with GCEvent

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

the class TestDataReaderJRockit1_5_0 method testGcPrioThroughput.

@Test
public void testGcPrioThroughput() throws Exception {
    DataReader reader = getDataReader1_5(new GcResourceFile("SampleJRockit1_5_12_gcpriothroughput.txt"));
    GCModel model = reader.read();
    assertEquals("count", 8, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 4.817, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 1641728, event.getPreUsed());
    assertEquals("after", 148365, event.getPostUsed());
    assertEquals("total", 3145728, event.getTotal());
    assertEquals("pause", 0.039959, event.getPause(), 0.0000001);
}
Also used : GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 25 with GCEvent

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

the class TestDataReaderJRockit1_6_0 method testGcPrioPauseSingleParConVerbose.

@Test
public void testGcPrioPauseSingleParConVerbose() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleJRockit1_6_verbose_gc_mode_singleparcon.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    assertTrue("should be DataReaderJRockit1_6_0 (but was " + reader.toString() + ")", reader instanceof DataReaderJRockit1_6_0);
    GCModel model = reader.read();
    assertEquals("count", 52, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 26.242, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_16_OLD_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 270909, event.getPreUsed());
    assertEquals("after", 210916, event.getPostUsed());
    assertEquals("total", 524288, event.getTotal());
    assertEquals("pause", 0.032087, event.getPause(), 0.0000001);
    assertEquals("number of warnings", 5, handler.getCount());
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Aggregations

GCEvent (com.tagtraum.perf.gcviewer.model.GCEvent)60 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)45 Test (org.junit.Test)33 AbstractGCEvent (com.tagtraum.perf.gcviewer.model.AbstractGCEvent)26 GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)21 GCResource (com.tagtraum.perf.gcviewer.model.GCResource)13 IOException (java.io.IOException)11 ByteArrayInputStream (java.io.ByteArrayInputStream)5 SimpleDateFormat (java.text.SimpleDateFormat)3 StringTokenizer (java.util.StringTokenizer)3 Paint (java.awt.Paint)2 StartElement (javax.xml.stream.events.StartElement)2 XMLEvent (javax.xml.stream.events.XMLEvent)2 Before (org.junit.Before)2 Type (com.tagtraum.perf.gcviewer.model.AbstractGCEvent.Type)1 ConcurrentGCEvent (com.tagtraum.perf.gcviewer.model.ConcurrentGCEvent)1 VmOperationEvent (com.tagtraum.perf.gcviewer.model.VmOperationEvent)1 GradientPaint (java.awt.GradientPaint)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1