Search in sources :

Example 46 with GCEvent

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

the class TotalYoungRenderer method computePolygon.

public Polygon computePolygon(ModelChart modelChart, GCModel model) {
    ScaledPolygon polygon = createMemoryScaledPolygon();
    polygon.addPoint(0.0d, 0.0d);
    double lastTenured = 0;
    double lastYoung = 0;
    for (Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents(); i.hasNext(); ) {
        AbstractGCEvent<?> abstractGCEvent = i.next();
        if (abstractGCEvent instanceof GCEvent) {
            GCEvent event = (GCEvent) abstractGCEvent;
            double tenuredSize = 0;
            double youngSize = 0;
            GCEvent young = event.getYoung();
            GCEvent tenured = event.getTenured();
            if (hasMemoryInformation(event) && young != null && tenured != null) {
                if (modelChart.isShowTenured()) {
                    tenuredSize = tenured.getTotal();
                }
                youngSize = young.getTotal();
                if (polygon.npoints == 1) {
                    // first point needs to be treated different from the rest,
                    // because otherwise the polygon would not start with a vertical line at 0,
                    // but with a slanting line between 0 and after the first pause
                    polygon.addPoint(0, tenuredSize + youngSize);
                }
                polygon.addPoint(event.getTimestamp() - model.getFirstPauseTimeStamp() + event.getPause(), tenuredSize + youngSize);
                lastYoung = youngSize;
                lastTenured = tenuredSize;
            }
        }
    }
    polygon.addPointNotOptimised(model.getRunningTime(), lastTenured + lastYoung);
    polygon.addPointNotOptimised(model.getRunningTime(), 0.0d);
    return polygon;
}
Also used : AbstractGCEvent(com.tagtraum.perf.gcviewer.model.AbstractGCEvent) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) AbstractGCEvent(com.tagtraum.perf.gcviewer.model.AbstractGCEvent)

Example 47 with GCEvent

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

the class TestDataReaderIBMJ9_5_0 method afTenuredGlobal.

@Test
public void afTenuredGlobal() throws Exception {
    final DataReader reader = getDataReader("SampleIBMJ9_5_0af-global-200811_07.txt");
    GCModel model = reader.read();
    assertEquals("count", 1, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("pause", 0.035912, event.getPause(), 0.0000001);
    assertEquals("timestamp", 0, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.FULL_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", (52428800 - 2621440) / 1024, event.getPreUsed());
    assertEquals("after", (52428800 - 40481192) / 1024, event.getPostUsed());
    assertEquals("total", 52428800 / 1024, event.getTotal());
}
Also used : GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 48 with GCEvent

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

the class TestDataReaderIBMJ9_5_0 method afTenuredGlobal_20090417_AA.

@Test
public void afTenuredGlobal_20090417_AA() throws Exception {
    final DataReader reader = getDataReader("SampleIBMJ9_5_0af-global-20090417_AA.txt");
    GCModel model = reader.read();
    assertEquals("count", 1, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("pause", 0.837024, event.getPause(), 0.0000001);
    assertEquals("timestamp", 0, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.FULL_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", (12884901888L - 4626919608L) / 1024, event.getPreUsed());
    assertEquals("after", (12884901888L - 10933557088L) / 1024, event.getPostUsed());
    assertEquals("total", 12884901888L / 1024, event.getTotal());
}
Also used : GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 49 with GCEvent

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

the class TestDataReaderIBM_J9_R26 method testFullHeaderWithAfGcs.

@Test
public void testFullHeaderWithAfGcs() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R26_GAFP1_full_header.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.00529, 0.0000001));
    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 50 with GCEvent

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

the class TestDataReaderIBM_J9_R26 method testSystemGc.

@Test
public void testSystemGc() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R26_GAFP1_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.036392, 0.0000001));
    assertThat("total before", event.getTotal(), is(toKiloBytes(514064384)));
    assertThat("free before", event.getPreUsed(), is(toKiloBytes(514064384 - 428417552)));
    assertThat("free after", event.getPostUsed(), is(toKiloBytes(514064384 - 479900360)));
    assertThat("total young before", event.getYoung().getTotal(), is(toKiloBytes(111411200)));
    assertThat("young before", event.getYoung().getPreUsed(), is(toKiloBytes(111411200 - 29431656)));
    assertThat("young after", event.getYoung().getPostUsed(), is(toKiloBytes(111411200 - 80831520)));
    assertThat("total tenured before", event.getTenured().getTotal(), is(toKiloBytes(402653184)));
    assertThat("tenured before", event.getTenured().getPreUsed(), is(toKiloBytes(402653184 - 398985896)));
    assertThat("tenured after", event.getTenured().getPostUsed(), is(toKiloBytes(402653184 - 399068840)));
    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)

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