Search in sources :

Example 26 with GCEvent

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

the class TestDataReaderJRockit1_6_0 method testStandardLine.

@Test
public void testStandardLine() throws Exception {
    final ByteArrayInputStream in = new ByteArrayInputStream(("[INFO ][memory ] [YC#1] 9.743-9.793: YC 294974KB->122557KB (524288KB), 0.050 s, sum of pauses 49.692 ms, longest pause 49.692 ms.").getBytes());
    DataReader reader = new DataReaderJRockit1_6_0(new GcResourceFile("byteArray"), in);
    GCModel model = reader.read();
    assertEquals("count", 1, model.size());
    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 9.743, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_16_YOUNG_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 294974, event.getPreUsed());
    assertEquals("after", 122557, event.getPostUsed());
    assertEquals("total", 524288, event.getTotal());
    assertEquals("pause", 0.049692, event.getPause(), 0.0000001);
}
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 27 with GCEvent

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

Example 28 with GCEvent

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

the class TestDataReaderSun1_2_2 method testParse1.

@Test
public void testParse1() throws Exception {
    AbstractGCEvent<GCEvent> event1 = new GCEvent(0, 817, 187, 819, 0.008, AbstractGCEvent.Type.GC);
    event1.getGeneration();
    AbstractGCEvent<GCEvent> event2 = new GCEvent(0.02, 775, 188, 819, 0.005, AbstractGCEvent.Type.GC);
    event2.getGeneration();
    AbstractGCEvent<GCEvent> event3 = new GCEvent(0.741, 1213, 1213, 1639, 0.0, AbstractGCEvent.Type.GC);
    event3.getGeneration();
    ByteArrayInputStream in = new ByteArrayInputStream(("<GC: 0 milliseconds since last GC>\n" + "<GC: freed 2807 objects, 645224 bytes in 8 ms, 77% free (646672/838856)>\n" + "  <GC: init&scan: 0 ms, scan handles: 7 ms, sweep: 1 ms, compact: 0 ms>\n" + "  <GC: 0 register-marked objects, 4 stack-marked objects>\n" + "  <GC: 1 register-marked handles, 42 stack-marked handles>\n" + "  <GC: refs: soft 0 (age >= 32), weak 0, final 2, phantom 0>\n" + "<GC: managing allocation failure: need 2128 bytes, type=1, action=1>\n" + "<GC: 20 milliseconds since last GC>\n" + "<GC: freed 672 objects, 601032 bytes in 5 ms, 77% free (646040/838856)>\n" + "<GC: 721 milliseconds since last GC>\n" + "<GC: expanded object space by 839680 to 1678536 bytes, 74% free>\n").getBytes());
    DataReader reader = new DataReaderSun1_2_2(new GcResourceFile("byteArray"), in);
    GCModel model = reader.read();
    assertEquals(3, model.size());
    Iterator<GCEvent> i = model.getGCEvents();
    GCEvent event = i.next();
    System.err.println(event.toString());
    assertEquals(event1, event);
    event = i.next();
    System.err.println(event.toString());
    assertEquals(event2, event);
    event = i.next();
    System.err.println(event.toString());
    assertEquals(event3, event);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) AbstractGCEvent(com.tagtraum.perf.gcviewer.model.AbstractGCEvent) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 29 with GCEvent

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

the class SimpleGcWriterTest method setUp.

@Before
public void setUp() throws Exception {
    //      0.677: [GC 0.677: [ParNew: 118010K->13046K(118016K), 0.0299506 secs] 175499K->104936K(249088K), 0.0300629 secs] [Times: user=0.06 sys=0.06, real=0.03 secs] 
    //      0.708: [GC [1 CMS-initial-mark: 91890K(131072K)] 109176K(249088K), 0.0004006 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
    //      0.708: [CMS-concurrent-mark-start]
    //      0.714: [CMS-concurrent-mark: 0.006/0.006 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
    //      0.714: [CMS-concurrent-preclean-start]
    //      0.715: [CMS-concurrent-preclean: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
    //      0.715: [CMS-concurrent-abortable-preclean-start]
    //      0.769: [GC 0.769: [ParNew: 118006K->118006K(118016K), 0.0000176 secs]0.769: [CMS0.769: [CMS-concurrent-abortable-preclean: 0.001/0.055 secs] [Times: user=0.02 sys=0.00, real=0.06 secs] 
    //       (concurrent mode failure): 91890K->20323K(131072K), 0.0186232 secs] 209896K->20323K(249088K), [CMS Perm : 2561K->2560K(21248K)], 0.0187293 secs] [Times: user=0.01 sys=0.00, real=0.02 secs] 
    //      0.877: [GC 0.877: [ParNew: 104960K->13040K(118016K), 0.0256080 secs] 125283K->78706K(249088K), 0.0256748 secs] [Times: user=0.08 sys=0.00, real=0.03 secs] 
    GCEvent gcEvent = new GCEvent(0.677, 175499, 104936, 249088, 0.0300629, AbstractGCEvent.Type.GC);
    GCEvent parNew = new GCEvent(0.677, 118010, 13046, 118016, 0.0299506, AbstractGCEvent.Type.PAR_NEW);
    gcEvent.add(parNew);
    GCEvent gcEvent2 = new GCEvent(0.708, 109176, 109176, 249088, 0.0004006, AbstractGCEvent.Type.GC);
    GCEvent initialMark = new GCEvent(0.708, 91890, 91890, 131072, 0, AbstractGCEvent.Type.CMS_INITIAL_MARK);
    gcEvent2.add(initialMark);
    ConcurrentGCEvent concGCEvent = new ConcurrentGCEvent();
    concGCEvent.setTimestamp(0.708);
    concGCEvent.setType(AbstractGCEvent.Type.CMS_CONCURRENT_MARK_START);
    gcModel = new GCModel();
    gcModel.add(gcEvent);
    gcModel.add(gcEvent2);
    gcModel.add(concGCEvent);
}
Also used : ConcurrentGCEvent(com.tagtraum.perf.gcviewer.model.ConcurrentGCEvent) ConcurrentGCEvent(com.tagtraum.perf.gcviewer.model.ConcurrentGCEvent) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) AbstractGCEvent(com.tagtraum.perf.gcviewer.model.AbstractGCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Before(org.junit.Before)

Example 30 with GCEvent

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

the class TestDataReaderIBM_J9_R28 method testSysGlobal.

@Test
public void testSysGlobal() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R28_sys_global.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertThat("model size", model.size(), is(1));
    GCEvent event = (GCEvent) model.get(0);
    assertThat("pause", event.getPause(), closeTo(0.097756, 0.0000001));
    assertThat("type", event.getTypeAsString(), equalTo("sys explicit global; nursery; tenure"));
    assertThat("number of errors", handler.getCount(), is(0));
}
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

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