Package com.tagtraum.perf.gcviewer.model

Examples of com.tagtraum.perf.gcviewer.model.GCEvent


    public void write(GCModel model) throws IOException {
        writeHeader();
       
        Iterator<GCEvent> i = model.getGCEvents();
        while (i.hasNext()) {
            GCEvent event = i.next();
            // write always two lines so that there is a nice used memory curve
            if (model.hasCorrectTimestamp()) {
                // we have the timestamps therefore we can correct it with the pause time
                out.print((event.getTimestamp() - event.getPause()));
            } else {
                out.print(event.getTimestamp());
            }
            out.print(',');
            out.print(event.getPreUsed()); // pre
            out.print(',');
            out.print(event.getTotal());
            out.print(',');
            out.print(event.getPause());
            out.print(',');
            out.println(event.getExtendedType());

            out.print(event.getTimestamp());
            out.print(',');
            out.print(event.getPostUsed()); // post
            out.print(',');
            out.print(event.getTotal());
            out.print(',');
            out.print(0);
            out.print(',');
            out.println("NONE");
        }
View Full Code Here


            model.setFormat(GCModel.Format.IBM_VERBOSE_GC);
           
            // Initialize local variables
            int state = 0;
            String line = null;
            GCEvent event = null;
            int freed = 0;
            int previousCycle = 0;
            int currentCycle = 0;
            long basetime = 0;
           
            // Initialize date formatter
            cycleStartGCFormat = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
           
            // Read the GC data lines
            while ((line = in.readLine()) != null) {
                final String trimmedLine = line.trim();
                // GC Data line always start with GC
                if (!"".equals(trimmedLine) && !trimmedLine.startsWith("GC")) {
                    if (LOG.isLoggable(Level.INFO)) LOG.info("Malformed line (" + in.getLineNumber() + "): " + line);
                    state = 0;
                }
                switch (state) {
                    case 0:
                        if (line.indexOf("GC:") != -1) {
                          // This is the start of the GC log
                            event = new GCEvent();
                            event.setType(AbstractGCEvent.Type.GC);
                            event.setPreUsed(parseInitialHeap(line));
                            event.setPostUsed(event.getPreUsed());
                            event.setTotal(event.getPreUsed());
                            model.add(event);
                            event = null;
                            // stay in state 0
                            break;
                        }
                        else if (line.indexOf("collection starting") != -1) {
                          // This is the start of a GC event
                            event = new GCEvent();
                            event.setType(AbstractGCEvent.Type.GC);
                            final long time = parseGCCycleStart(line);
                            if (basetime == 0) basetime = time;
                            event.setTimestamp((time - basetime)/1000.0d);
                            state++;
                            break;
                        }
                        break;
                    case 1:
                      // Collect data to add to the event
                        if (line.indexOf("current heap(KB) ") != -1) {
                            event.setTotal(parseTotalAfterGC(line));
                            break;
                        } else if (line.indexOf("collect (milliseconds) ") != -1) {
              event.setPause(parsePause(line));
              break;
                        } else if (line.indexOf("collected(KB) ") != -1) {
              freed = parseFreed(line);
              break;
                        } else if (line.indexOf("current cycle allocation(KB) ") != -1) {
              previousCycle = parsePreviousCycle(line);
              currentCycle = parseCurrentCycle(line);
              event.setPreUsed((event.getTotal() - previousCycle - currentCycle) + freed);
              event.setPostUsed((event.getTotal() - previousCycle - currentCycle));
              break;
            } else if (line.indexOf("collection ending") != -1) {
              // End of GC event, store data in the model and reset variables
              model.add(event);
              event = null;
View Full Code Here

    public void write(GCModel model) throws IOException {
        writeHeader();
       
        Iterator<GCEvent> i = model.getGCEvents();
        while (i.hasNext()) {
            GCEvent event = i.next();
            // Since this data writer is only concerned with one line per gc entry, don't write two like the others.

            // If the true timestamp is present, output the unix timestamp
            if (model.hasDateStamp()) {
                out.print(event.getDatestamp().getTime());
            } else if (model.hasCorrectTimestamp()) {
                // we have the timestamps therefore we can correct it with the pause time
                out.print((event.getTimestamp() - event.getPause()));
            } else {
                out.print(event.getTimestamp());
            }
            out.print(',');
            out.print(event.getPreUsed()); // pre
            out.print(',');
            out.print(event.getTotal());
            out.print(',');
            out.print(event.getPause());
            out.print(',');
            out.println(event.getExtendedType());
        }
        out.flush();
    }
View Full Code Here

        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,
View Full Code Here

    }

    public Polygon computePolygon(ModelChart modelChart, GCModel model) {
        ScaledPolygon polygon = createMemoryScaledPolygon();
        for (Iterator<GCEvent> i = model.getGCEvents(); i.hasNext();) {
            GCEvent event = i.next();
            if (event.isInitialMark()) {
                polygon.addPoint(event.getTimestamp() - model.getFirstPauseTimeStamp(), event.getPreUsed());
            }
        }
        // Don't add dummy point to make the polygon complete! Just stop drawing.
        return polygon;
    }
View Full Code Here

    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) {
                    // only -XX:+PrintGCDetails adds information about generations
                    // 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
View Full Code Here

    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);
View Full Code Here

    }

    @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
View Full Code Here

        polygon.addPoint(0.0d, 0.0d);
        double lastTotal = 0.0d;
        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) {
                    double total = tenured.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.0d, total);
                        lastTotal = total;
                    }

                    if (lastTotal != total) {
                        polygon.addPoint(tenured.getTimestamp() - model.getFirstPauseTimeStamp(), lastTotal);
                    }
                    polygon.addPoint(tenured.getTimestamp() - model.getFirstPauseTimeStamp() + tenured.getPause(), total);
                    lastTotal = total;
                }
            }
        }
        polygon.addPointNotOptimised(model.getRunningTime(), lastTotal);
View Full Code Here

        polygon.addPoint(0.0d, 0.0d);
        int lastTotal = 0;
        for (Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents(); i.hasNext();) {
            AbstractGCEvent<?> abstractGCEvent = i.next();
            if (abstractGCEvent instanceof GCEvent) {
                GCEvent event = (GCEvent) abstractGCEvent;
                if (event.getTotal() > 0) {
                    // there are events that don't have a heap size associated (like "GC remark" of G1)
                    // -> skip them
                    polygon.addPoint(event.getTimestamp() - model.getFirstPauseTimeStamp(), event.getTotal());
                    lastTotal = event.getTotal();
                }
            }
        }
        polygon.addPointNotOptimised(model.getRunningTime(), lastTotal);
        polygon.addPointNotOptimised(model.getRunningTime(), 0.0d);
View Full Code Here

TOP

Related Classes of com.tagtraum.perf.gcviewer.model.GCEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.