Search in sources :

Example 1 with GCResource

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

the class GCResourceGroup method getGcResourceSeries.

private GCResource getGcResourceSeries(String entry) {
    GCResource resource;
    List<GCResource> series = new ArrayList<>();
    for (String s : entry.split(SERIES_SEPARATOR)) {
        series.add(new GcResourceFile(s));
    }
    resource = new GcResourceSeries(series);
    return resource;
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) ArrayList(java.util.ArrayList) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries)

Example 2 with GCResource

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

the class TestDataReaderJRockit1_5_0 method testMalformedType.

/**
     * Test parsing of a malformed type. The test just expects an INFO to be logged - nothing else.
     */
@Test
public void testMalformedType() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.INFO);
    GCResource gcResource = new GcResourceFile("byteArray");
    gcResource.getLogger().addHandler(handler);
    ByteArrayInputStream in = new ByteArrayInputStream(("[memory ][Thu Feb 21 15:06:38 2013][11844] 6.290-6.424: GC-malformed 3128161K->296406K (3145728K), sum of pauses 59.084 ms").getBytes());
    DataReader reader = new DataReaderJRockit1_5_0(gcResource, in);
    reader.read();
    // 3 INFO events:
    // Reading JRockit ... format
    // Failed to determine type ...
    // Reading done.
    assertEquals("number of infos", 3, handler.getCount());
    List<LogRecord> logRecords = handler.getLogRecords();
    assertEquals("should start with 'Failed to determine type'", 0, logRecords.get(1).getMessage().indexOf("Failed to determine type"));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) LogRecord(java.util.logging.LogRecord) GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) Test(org.junit.Test)

Example 3 with GCResource

use of com.tagtraum.perf.gcviewer.model.GCResource 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)

Example 4 with GCResource

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

the class TestDataReaderJRockit1_6_0 method testMalformedType.

@Test
public void testMalformedType() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.INFO);
    GCResource gcResource = new GcResourceFile("byteArray");
    gcResource.getLogger().addHandler(handler);
    ByteArrayInputStream in = new ByteArrayInputStream(("[INFO ][memory ] [YC#1] 9.743-9.793: YC-malformed 294974KB->122557KB (524288KB), 0.050 s, sum of pauses 49.692 ms, longest pause 49.692 ms.").getBytes());
    DataReader reader = new DataReaderJRockit1_6_0(gcResource, in);
    reader.read();
    // 3 INFO events:
    // Reading JRockit ... format
    // Failed to determine type ...
    // Reading done.
    assertEquals("number of infos", 3, handler.getCount());
    List<LogRecord> logRecords = handler.getLogRecords();
    assertEquals("should start with 'Failed to determine type'", 0, logRecords.get(1).getMessage().indexOf("Failed to determine type"));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) LogRecord(java.util.logging.LogRecord) GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) Test(org.junit.Test)

Example 5 with GCResource

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

the class TestDataReaderJRockit1_6_0 method testGcPrioPauseSingleParCon.

@Test
public void testGcPrioPauseSingleParCon() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleJRockit1_6_gc_mode_singleparcon.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertEquals("count", 42, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 24.930, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_16_OLD_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 464309, event.getPreUsed());
    assertEquals("after", 282831, event.getPostUsed());
    assertEquals("total", 524288, event.getTotal());
    assertEquals("pause", 0.020957, 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

GCResource (com.tagtraum.perf.gcviewer.model.GCResource)65 GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)55 Test (org.junit.Test)54 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)40 ByteArrayInputStream (java.io.ByteArrayInputStream)15 GCEvent (com.tagtraum.perf.gcviewer.model.GCEvent)13 GcResourceSeries (com.tagtraum.perf.gcviewer.model.GcResourceSeries)10 InputStream (java.io.InputStream)9 ArrayList (java.util.ArrayList)8 File (java.io.File)4 GCModelLoader (com.tagtraum.perf.gcviewer.ctrl.GCModelLoader)2 LogRecord (java.util.logging.LogRecord)2 GCModelLoaderGroupTracker (com.tagtraum.perf.gcviewer.ctrl.GCModelLoaderGroupTracker)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1