Search in sources :

Example 51 with GCEvent

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

the class TestDataReaderIBM_J9_R27 method testSystemGc.

@Test
public void testSystemGc() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R27_SR1_global.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertThat("model size", model.size(), is(1));
    GCEvent event = (GCEvent) model.get(0);
    assertThat("pause", event.getPause(), closeTo(0.075863, 0.0000001));
    assertThat("number of errors", handler.getCount(), is(0));
}
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)

Example 52 with GCEvent

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

the class TestDataReaderIBM_J9_R28 method testAfScavenge.

@Test
public void testAfScavenge() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R28_af_scavenge_full_header.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertThat("model size", model.size(), is(2));
    GCEvent event = (GCEvent) model.get(0);
    assertThat("pause", event.getPause(), closeTo(0.025388, 0.0000001));
    assertThat("total before", event.getTotal(), is(toKiloBytes(536870912)));
    assertThat("free before", event.getPreUsed(), is(toKiloBytes(536870912 - 401882552)));
    assertThat("free after", event.getPostUsed(), is(toKiloBytes(536870912 - 457545744)));
    assertThat("total young before", event.getYoung().getTotal(), is(toKiloBytes(134217728)));
    assertThat("young before", event.getYoung().getPreUsed(), is(toKiloBytes(134217728)));
    assertThat("young after", event.getYoung().getPostUsed(), is(toKiloBytes(134217728 - 55663192)));
    assertThat("total tenured before", event.getTenured().getTotal(), is(toKiloBytes(402653184)));
    assertThat("tenured before", event.getTenured().getPreUsed(), is(toKiloBytes(402653184 - 401882552)));
    assertThat("tenured after", event.getTenured().getPostUsed(), is(toKiloBytes(402653184 - 401882552)));
    assertThat("timestamp 1", event.getTimestamp(), closeTo(0.0, 0.0001));
    assertThat("timestamp 2", model.get(1).getTimestamp(), closeTo(1.272, 0.0001));
    assertThat("type", event.getTypeAsString(), equalTo("af scavenge; nursery; tenure"));
    assertThat("number of errors", handler.getCount(), is(0));
}
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)

Example 53 with GCEvent

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

the class TestDataReaderJRockit1_4_2 method testParseTsGCReportPrioPauseTime.

@Test
public void testParseTsGCReportPrioPauseTime() throws Exception {
    String fileName = "SampleJRockit1_4_2ts-gcreport-gcpriopausetime.txt";
    InputStream in = getInputStream(fileName);
    DataReader reader = new DataReaderFactory().getDataReader(new GcResourceFile(fileName), in);
    assertTrue("should be DataReaderJRockit1_4_2 (but was " + reader.toString() + ")", reader instanceof DataReaderJRockit1_4_2);
    GCModel model = reader.read();
    assertEquals("count", 64, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 18.785, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 32260, event.getPreUsed());
    assertEquals("after", 4028, event.getPostUsed());
    assertEquals("total", 32768, event.getTotal());
    assertEquals("pause", 0.024491, event.getPause(), 0.0000001);
}
Also used : InputStream(java.io.InputStream) 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 54 with GCEvent

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

the class TestDataReaderJRockit1_4_2 method testParsePrioPauseTime.

@Test
public void testParsePrioPauseTime() throws Exception {
    // TODO refactor JRockit DataReader
    DataReader reader = getDataReader1_5("SampleJRockit1_4_2priopausetime.txt");
    GCModel model = reader.read();
    assertEquals("count", 1867, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 12.622, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 320728, event.getPreUsed());
    assertEquals("after", 130908, event.getPostUsed());
    assertEquals("total", 358400, event.getTotal());
    assertEquals("pause", 0.025921, event.getPause(), 0.0000001);
}
Also used : GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 55 with GCEvent

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

the class TestDataReaderJRockit1_4_2 method testParseTsGCReportParallel.

@Test
public void testParseTsGCReportParallel() throws Exception {
    DataReader reader = getDataReader1_4("SampleJRockit1_4_2ts-gcreport-parallel.txt");
    GCModel model = reader.read();
    assertEquals("count", 31, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 20.547, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 32768, event.getPreUsed());
    assertEquals("after", 5552, event.getPostUsed());
    assertEquals("total", 32768, event.getTotal());
    assertEquals("pause", 0.072, event.getPause(), 0.0000001);
}
Also used : 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