Search in sources :

Example 16 with GCEvent

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

the class UsedTenuredRenderer method computePolygon.

@Override
public Polygon computePolygon(ModelChart modelChart, GCModel model) {
    ScaledPolygon polygon = createMemoryScaledPolygon();
    for (Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents(); i.hasNext(); ) {
        AbstractGCEvent<?> abstractGCEvent = i.next();
        if (abstractGCEvent instanceof GCEvent) {
            GCEvent event = (GCEvent) abstractGCEvent;
            GCEvent tenuredEvent = event.getTenured();
            if (tenuredEvent != null) {
                // e.g. "GC remark" of G1 algorithm does not contain memory information
                if (tenuredEvent.getTotal() > 0) {
                    final double timestamp = event.getTimestamp() - model.getFirstPauseTimeStamp();
                    polygon.addPoint(timestamp, tenuredEvent.getPreUsed());
                    polygon.addPoint(timestamp + event.getPause(), tenuredEvent.getPostUsed());
                }
            }
        }
    }
    // dummy point to make the polygon complete
    polygon.addPoint(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 17 with GCEvent

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

the class UsedYoungRenderer method computePolygon.

@Override
public Polygon computePolygon(ModelChart modelChart, GCModel model) {
    ScaledPolygon polygon = createMemoryScaledPolygon();
    GCEvent lastTenuredEvent = null;
    GCEvent tenuredEvent = null;
    for (Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents(); i.hasNext(); ) {
        AbstractGCEvent<?> abstractGCEvent = i.next();
        if (abstractGCEvent instanceof GCEvent) {
            GCEvent event = (GCEvent) abstractGCEvent;
            GCEvent youngEvent = event.getYoung();
            int lastTenuredTotal = 0;
            int tenuredTotal = 0;
            if (youngEvent != null) {
                // event contains information about generation (only with -XX:+PrintGCDetails)
                if (modelChart.isShowTenured()) {
                    if (tenuredEvent != null && tenuredEvent.getTotal() > 0) {
                        lastTenuredEvent = tenuredEvent;
                    }
                    if (lastTenuredEvent == null)
                        lastTenuredEvent = event.getTenured();
                    tenuredEvent = event.getTenured();
                    lastTenuredTotal = lastTenuredEvent.getTotal();
                    tenuredTotal = tenuredEvent.getTotal();
                }
                // e.g. "GC remark" of G1 algorithm does not contain memory information
                if (youngEvent.getTotal() > 0) {
                    final double timestamp = event.getTimestamp() - model.getFirstPauseTimeStamp();
                    polygon.addPoint(timestamp, lastTenuredTotal + youngEvent.getPreUsed());
                    polygon.addPoint(timestamp + event.getPause(), tenuredTotal + youngEvent.getPostUsed());
                }
            }
        }
    }
    // dummy point to make the polygon complete
    polygon.addPoint(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) Paint(java.awt.Paint)

Example 18 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 19 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 20 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