Search in sources :

Example 36 with GCEvent

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

the class ModelMetricsPanelTest method testVmOpModel.

@Test
public void testVmOpModel() {
    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);
    VmOperationEvent vmOpEvent = new VmOperationEvent();
    vmOpEvent.setTimestamp(0.7);
    vmOpEvent.setType(Type.APPLICATION_STOPPED_TIME);
    vmOpEvent.setPause(0.26);
    model.add(vmOpEvent);
    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 : VmOperationEvent(com.tagtraum.perf.gcviewer.model.VmOperationEvent) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 37 with GCEvent

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

the class TestDataReaderSun1_6_0 method testPrintCmsStatisticsScavengeBeforeRemark.

/**
     * Tests the combination of -XX:PrintCmsStatistics=2 and -XX:+CMSScavengeBeforeRemark
     */
@Test
public void testPrintCmsStatisticsScavengeBeforeRemark() throws Exception {
    ByteArrayInputStream in = new ByteArrayInputStream(("2012-10-26T18:31:09.699+0200: 15.473: [GC[YG occupancy: 8752 K (78656 K)]2012-10-26T18:31:09.699+0200: 15.473: [GC 15.473: [ParNew: 8752K->64K(78656K), 0.0052352 secs] 388874K->388870K(515584K), 0.0052868 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]" + "\n15.478: [Rescan (parallel)  (Survivor:0chunks) Finished young gen rescan work in 1th thread: 0.000 sec" + "\nFinished young gen rescan work in 1th thread: 0.000 sec" + "\nFinished young gen rescan work in 0th thread: 0.000 sec" + "\nFinished remaining root rescan work in 1th thread: 0.000 sec" + "\nFinished remaining root rescan work in 2th thread: 0.000 sec" + "\nFinished remaining root rescan work in 0th thread: 0.000 sec" + "\nFinished dirty card rescan work in 0th thread: 0.001 sec" + "\nFinished dirty card rescan work in 2th thread: 0.001 sec" + "\nFinished dirty card rescan work in 1th thread: 0.001 sec" + "\nFinished young gen rescan work in 3th thread: 0.000 sec" + "\nFinished remaining root rescan work in 3th thread: 0.000 sec" + "\nFinished dirty card rescan work in 3th thread: 0.000 sec" + "\nFinished work stealing in 3th thread: 0.000 sec" + "\nFinished work stealing in 2th thread: 0.000 sec" + "\nFinished work stealing in 0th thread: 0.000 sec" + "\nFinished work stealing in 1th thread: 0.000 sec" + "\n, 0.0006571 secs]15.479: [weak refs processing, 0.0000041 secs]15.479: [class unloading, 0.0001106 secs]15.479: [scrub symbol table, 0.0004465 secs]15.480: [scrub string table, 0.0000168 secs] [1 CMS-remark: 388806K(436928K)] 388870K(515584K), 0.0067111 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]").getBytes());
    DataReader reader = new DataReaderSun1_6_0(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6);
    GCModel model = reader.read();
    assertEquals("GC count", 2, model.size());
    GCEvent parNew = (GCEvent) model.get(0);
    GCEvent remarkEvent = (GCEvent) model.get(1);
    assertEquals("GC pause ParNew", 0.0052868, parNew.getPause(), 0.000000001);
    assertEquals("GC pause Remark", 0.0067111 - 0.0052868, remarkEvent.getPause(), 0.000000001);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) 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 38 with GCEvent

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

the class TestDataReaderSun1_8_0G1 method fullGcWithDetailedSizes.

/**
     * In java 8, suddenly the full gc events in G1 got detailed information about the generation
     * sizes again. Test, that they are parsed correctly.
     */
@Test
public void fullGcWithDetailedSizes() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("byteArray");
    ByteArrayInputStream in = new ByteArrayInputStream(("2014-07-24T13:49:45.090+0400: 92457.841: [Full GC (Allocation Failure)  5811M->3097M(12G), 8.9862292 secs]" + "\n  [Eden: 4096.0K(532.0M)->0.0B(612.0M) Survivors: 80.0M->0.0B Heap: 5811.9M(12.0G)->3097.8M(12.0G)], [Metaspace: 95902K->95450K(1140736K)]" + "\n [Times: user=12.34 sys=0.22, real=8.99 secs]").getBytes());
    DataReader reader = new DataReaderSun1_6_0G1(gcResource, in, GcLogType.SUN1_8);
    GCModel model = reader.read();
    GCEvent event = (GCEvent) model.get(0);
    assertThat("footprint", event.getTotal(), is(12 * 1024 * 1024));
    assertThat("yound before", event.getYoung().getPreUsed(), is(4096 + 80 * 1024));
    assertThat("tenured", event.getTenured().getTotal(), is(12 * 1024 * 1024 - 612 * 1024));
    assertThat("metaspace", event.getPerm().getTotal(), is(1140736));
    assertThat("perm", model.getPermAllocatedSizes().getN(), is(1));
    assertThat("warning count", handler.getCount(), is(0));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) 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 39 with GCEvent

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

the class TestGCResourceGroup method setup.

@Before
public void setup() {
    GCResource gcResource1 = new GcResourceFile("gcResource1");
    gcResource1.getModel().add(new GCEvent(1.1, 100, 50, 200, 0.003, Type.GC));
    GCResource gcResource2 = new GcResourceFile("gcResource2");
    gcResource2.getModel().add(new GCEvent(1.5, 1000, 400, 2000, 0.044, Type.FULL_GC));
    gcResourceList = new ArrayList<>();
    gcResourceList.add(gcResource1);
    gcResourceList.add(gcResource2);
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) Before(org.junit.Before)

Example 40 with GCEvent

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

the class CSVTSDataWriter method write.

/**
     * Writes the model and flushes the internal PrintWriter.
     */
public void write(GCModel model) throws IOException {
    writeHeader();
    Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents();
    while (i.hasNext()) {
        AbstractGCEvent<?> abstractGCEvent = i.next();
        // filter "application stopped" events
        if (abstractGCEvent instanceof GCEvent) {
            GCEvent event = (GCEvent) abstractGCEvent;
            // If the true timestamp is present, output the unix timestamp
            if (model.hasDateStamp()) {
                out.print(event.getDatestamp().toInstant().getEpochSecond());
            } 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(',');
            // pre
            out.print(event.getPreUsed());
            out.print(',');
            out.print(event.getTotal());
            out.print(',');
            out.print(event.getPause());
            out.print(',');
            out.println(event.getExtendedType());
        }
    }
    out.flush();
}
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