Search in sources :

Example 61 with GcResourceFile

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

the class TestDataReaderSun1_6_0 method testPrintCmsStatisticsRemark.

@Test
public void testPrintCmsStatisticsRemark() throws Exception {
    ByteArrayInputStream in = new ByteArrayInputStream(("2012-10-20T18:04:59.443+0200: 2.918: [GC[YG occupancy: 8752 K (78656 K)]2.918: [Rescan (parallel)  (Survivor:1chunks) Finished young gen rescan work in 2th 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.0008918 secs]2.919: [weak refs processing, 0.0000057 secs]2.919: [class unloading, 0.0001020 secs]2.919: [scrub symbol & string tables, 0.0003265 secs] [1 CMS-remark: 376134K(436928K)] 384886K(515584K), 0.0014952 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", 1, model.size());
    assertEquals("GC pause", 0.0014952, model.getGCPause().getMin(), 0.000000001);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 62 with GcResourceFile

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

the class TestDataReaderSun1_6_0 method testDerivedGenerationValues.

/**
     * Often only the young generation information is explicitly present. Old generation memory
     * size can be derived from heap - young size. This test checks for presence of derived memory
     * information.
     */
@Test
public void testDerivedGenerationValues() throws Exception {
    ByteArrayInputStream in = new ByteArrayInputStream("10.675: [GC [PSYoungGen: 21051K->4947K(22656K)] 23342K->7238K(67712K), 0.0191817 secs] [Times: user=0.09 sys=0.01, real=0.02 secs]".getBytes());
    DataReader reader = new DataReaderSun1_6_0(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6);
    GCModel model = reader.read();
    assertEquals("GC count", 1, model.size());
    assertEquals("young used", 21051, model.getYoungUsedSizes().getMin());
    assertEquals("young allocated", 22656, model.getYoungAllocatedSizes().getMax());
    assertEquals("tenured used", 23342 - 21051, model.getTenuredUsedSizes().getMin());
    assertEquals("tenured allocated", 67712 - 22656, model.getTenuredAllocatedSizes().getMax());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 63 with GcResourceFile

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

the class TestDataReaderSun1_6_0 method testPrintHeapAtGC.

@Test
public void testPrintHeapAtGC() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleSun1_6_0PrintHeapAtGC.txt");
    gcResource.getLogger().addHandler(handler);
    InputStream in = getInputStream(gcResource.getResourceName());
    DataReader reader = new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_6);
    GCModel model = reader.read();
    assertEquals("GC count", 2, model.size());
    assertEquals("GC pause", 0.0134287, model.getGCPause().getMin(), 0.000000001);
    assertEquals("number of errors", 0, handler.getCount());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 64 with GcResourceFile

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

the class TestDataReaderSun1_6_0 method logfileRollingProducesNoWarnings.

@Test
public void logfileRollingProducesNoWarnings() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleSun1_8_0RollingLogfile.txt");
    gcResource.getLogger().addHandler(handler);
    InputStream in = getInputStream(gcResource.getResourceName());
    DataReader reader = new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_6);
    reader.read();
    assertThat("number of errors", handler.getCount(), is(0));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) Test(org.junit.Test)

Example 65 with GcResourceFile

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

the class TestDataReaderSun1_6_0 method testPrintCmsStatisticsConcurrentMark.

@Test
public void testPrintCmsStatisticsConcurrentMark() throws Exception {
    ByteArrayInputStream in = new ByteArrayInputStream(("2012-10-20T18:04:57.850+0200: 1.327: [CMS-concurrent-mark: 0.011/0.011 secs] (CMS-concurrent-mark yielded 0 times)" + "\n [Times: user=0.03 sys=0.00, real=0.01 secs]").getBytes());
    DataReader reader = new DataReaderSun1_6_0(new GcResourceFile("byteArray"), in, GcLogType.SUN1_6);
    GCModel model = reader.read();
    assertEquals("GC count", 1, model.size());
    assertEquals("GC pause", 0.011, model.getConcurrentEventPauses().values().iterator().next().getMin(), 0.000000001);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Aggregations

GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)186 Test (org.junit.Test)178 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)133 ByteArrayInputStream (java.io.ByteArrayInputStream)118 InputStream (java.io.InputStream)69 GCResource (com.tagtraum.perf.gcviewer.model.GCResource)55 GCEvent (com.tagtraum.perf.gcviewer.model.GCEvent)21 GcResourceSeries (com.tagtraum.perf.gcviewer.model.GcResourceSeries)11 File (java.io.File)8 ArrayList (java.util.ArrayList)6 GCViewerGuiController (com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController)2 AbstractGCEvent (com.tagtraum.perf.gcviewer.model.AbstractGCEvent)2 LogRecord (java.util.logging.LogRecord)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)2 GCModelLoader (com.tagtraum.perf.gcviewer.ctrl.GCModelLoader)1 DataReader (com.tagtraum.perf.gcviewer.imp.DataReader)1 DataReaderFactory (com.tagtraum.perf.gcviewer.imp.DataReaderFactory)1 DoubleData (com.tagtraum.perf.gcviewer.math.DoubleData)1 IntData (com.tagtraum.perf.gcviewer.math.IntData)1