Search in sources :

Example 31 with GCEvent

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

the class TestDataReaderJRockit1_4_2 method testParseGenCon.

@Test
public void testParseGenCon() throws Exception {
    // TODO refactor JRockit DataReader
    DataReader reader = getDataReader1_5("SampleJRockit1_4_2gencon.txt");
    GCModel model = reader.read();
    assertEquals("count", 123, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 77.737, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_NURSERY_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 630435, event.getPreUsed());
    assertEquals("after", 183741, event.getPostUsed());
    assertEquals("total", 1048576, event.getTotal());
    assertEquals("pause", 0.566158, 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 32 with GCEvent

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

the class TestDataReaderJRockit1_5_0 method testGenCon.

@Test
public void testGenCon() throws Exception {
    DataReader reader = getDataReader1_5(new GcResourceFile("SampleJRockit1_5_12_gencon.txt"));
    GCModel model = reader.read();
    assertEquals("count", 8, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 6.038, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 3089328, event.getPreUsed());
    assertEquals("after", 352551, event.getPostUsed());
    assertEquals("total", 3145728, event.getTotal());
    assertEquals("pause", 0.1186, 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 33 with GCEvent

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

the class TestDataReaderIBM_J9_R27 method testFullHeaderWithAfGcs.

@Test
public void testFullHeaderWithAfGcs() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R27_SR1_full_header.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertThat("model size", model.size(), is(3));
    GCEvent event = (GCEvent) model.get(0);
    assertThat("pause", event.getPause(), closeTo(0.042303, 0.0000001));
    assertThat("total before", event.getTotal(), is(toKiloBytes(1073741824)));
    assertThat("free before", event.getPreUsed(), is(toKiloBytes(1073741824 - 804158480)));
    assertThat("free after", event.getPostUsed(), is(toKiloBytes(1073741824 - 912835672)));
    assertThat("total young before", event.getYoung().getTotal(), is(toKiloBytes(268435456)));
    assertThat("young before", event.getYoung().getPreUsed(), is(toKiloBytes(268435456)));
    assertThat("young after", event.getYoung().getPostUsed(), is(toKiloBytes(268435456 - 108677192)));
    assertThat("total tenured before", event.getTenured().getTotal(), is(toKiloBytes(805306368)));
    assertThat("tenured before", event.getTenured().getPreUsed(), is(toKiloBytes(805306368 - 804158480)));
    assertThat("tenured after", event.getTenured().getPostUsed(), is(toKiloBytes(805306368 - 804158480)));
    assertThat("timestamp 1", event.getTimestamp(), closeTo(0.0, 0.0001));
    assertThat("timestamp 2", model.get(1).getTimestamp(), closeTo(1.927, 0.0001));
    assertThat("timestamp 3", model.get(2).getTimestamp(), closeTo(3.982, 0.0001));
    assertThat("number of errors", handler.getCount(), is(1));
}
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 34 with GCEvent

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

the class ModelMetricsPanelTest method testOneElementModel.

@Test
public void testOneElementModel() {
    GCEvent event = new GCEvent();
    event.setTimestamp(0.5);
    event.setType(Type.G1_YOUNG_INITIAL_MARK);
    event.setPause(0.245);
    event.setPreUsed(900);
    event.setPostUsed(400);
    event.setTotal(1024);
    GCModel model = new GCModel();
    model.add(event);
    ModelMetricsPanel panel = new ModelMetricsPanel();
    // first add empty model; is done when opened
    panel.setModel(new GCModel());
    // only later a model with entries is set
    panel.setModel(model);
}
Also used : GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 35 with GCEvent

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

the class ModelMetricsPanelTest method testTwoElementsModel.

@Test
public void testTwoElementsModel() {
    GCModel model = new GCModel();
    GCEvent event = new GCEvent();
    event.setTimestamp(0.5);
    event.setType(Type.G1_YOUNG_INITIAL_MARK);
    event.setPause(0.245);
    event.setPreUsed(900);
    event.setPostUsed(400);
    event.setTotal(1024);
    model.add(event);
    event = new GCEvent();
    event.setTimestamp(0.75);
    event.setType(Type.G1_YOUNG_INITIAL_MARK);
    event.setPause(0.245);
    event.setPreUsed(800);
    event.setPostUsed(300);
    event.setTotal(1024);
    model.add(event);
    ModelMetricsPanel panel = new ModelMetricsPanel();
    panel.setModel(model);
}
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