Search in sources :

Example 11 with GCEvent

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

the class DataReaderSun1_3_1 method parseLine.

protected AbstractGCEvent<GCEvent> parseLine(String line, ParseInformation pos) throws ParseException {
    AbstractGCEvent<GCEvent> event = new GCEvent();
    try {
        event.setTimestamp(count);
        count++;
        StringTokenizer st = new StringTokenizer(line, " ,->()K\r\n");
        String token = st.nextToken();
        if (token.equals("Full") && st.nextToken().equals("GC")) {
            event.setType(AbstractGCEvent.Type.FULL_GC);
        } else if (token.equals("Inc") && st.nextToken().equals("GC")) {
            event.setType(AbstractGCEvent.Type.INC_GC);
        } else if (token.equals("GC")) {
            event.setType(AbstractGCEvent.Type.GC);
        } else {
            throw new ParseException("Error parsing entry: " + line);
        }
        setMemoryAndPauses((GCEvent) event, line);
        //System.out.println("Real  : [" + line + "]");
        return event;
    } catch (RuntimeException rte) {
        final ParseException parseException = new ParseException("Error parsing entry: " + line + ", " + rte.toString());
        parseException.initCause(rte);
        throw parseException;
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) AbstractGCEvent(com.tagtraum.perf.gcviewer.model.AbstractGCEvent)

Example 12 with GCEvent

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

the class IncLineRenderer method paintComponent.

public void paintComponent(Graphics2D g2d) {
    double scaleFactor = getModelChart().getScaleFactor();
    int height = getHeight();
    int lastScaledTimestamp = Integer.MIN_VALUE;
    for (Iterator<GCEvent> i = getModelChart().getModel().getGCEvents(); i.hasNext(); ) {
        GCEvent event = i.next();
        if (event.isInc()) {
            int scaledTimestamp = (int) (scaleFactor * (event.getTimestamp() - getModelChart().getModel().getFirstPauseTimeStamp()));
            if (scaledTimestamp != lastScaledTimestamp) {
                g2d.drawLine(scaledTimestamp, 0, scaledTimestamp, height);
                lastScaledTimestamp = scaledTimestamp;
            }
        }
    }
}
Also used : GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent)

Example 13 with GCEvent

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

the class TotalTenuredRenderer method computePolygon.

public Polygon computePolygon(ModelChart modelChart, GCModel model) {
    ScaledPolygon polygon = createMemoryScaledPolygon();
    polygon.addPoint(0.0d, 0.0d);
    double lastTotal = 0;
    for (Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents(); i.hasNext(); ) {
        AbstractGCEvent<?> abstractGCEvent = i.next();
        if (abstractGCEvent instanceof GCEvent) {
            GCEvent event = (GCEvent) abstractGCEvent;
            GCEvent tenured = event.getTenured();
            if (hasMemoryInformation(event) && tenured != null) {
                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, (double) tenured.getTotal());
                }
                polygon.addPoint(tenured.getTimestamp() - model.getFirstPauseTimeStamp() + event.getPause(), tenured.getTotal());
                lastTotal = tenured.getTotal();
            }
        }
    }
    polygon.addPointNotOptimised(model.getRunningTime(), lastTotal);
    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 14 with GCEvent

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

the class UsedHeapRenderer method computePolygon.

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;
            // e.g. "GC remark" of G1 algorithm does not contain memory information
            if (event.getTotal() > 0) {
                final double timestamp = event.getTimestamp() - model.getFirstPauseTimeStamp();
                polygon.addPoint(timestamp, event.getPreUsed());
                polygon.addPoint(timestamp + event.getPause(), event.getPostUsed());
            }
        }
    }
    // dummy point to make the polygon complete
    polygon.addPoint(model.getRunningTime(), 0.0d);
    //System.out.println("last x coord " + polygon.xpoints[polygon.npoints-1]);
    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 15 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)

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