예제 #1
0
  @Test
  public void testCMSAdaptiveSizePolicyPrintHeapAtGC() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    IMP_LOGGER.addHandler(handler);
    DATA_READER_FACTORY_LOGGER.addHandler(handler);

    ByteArrayInputStream in =
        new ByteArrayInputStream(
            ("2012-04-18T14:48:31.855+0200: 29.592: [GC 29.592: [ASParNew: 52825K->6499K(59008K), 0.0268761 secs] 120805K->120749K(517760K), 0.0269605 secs] [Times: user=0.05 sys=0.00, real=0.03 secs]"
                    + "\nHeap"
                    + "\nadaptive size par new generation total 59008K, used 15368K [0x00000000d8000000, 0x00000000dc000000, 0x00000000dc000000)"
                    + "\n eden space 52480K,  16% used [0x00000000d8000000, 0x00000000d88a95a0, 0x00000000db340000)"
                    + "\n from space 6528K,  99% used [0x00000000db340000, 0x00000000db998cb0, 0x00000000db9a0000)"
                    + "\n to   space 6528K,   0% used [0x00000000db9a0000, 0x00000000db9a0000, 0x00000000dc000000)"
                    + "\nconcurrent mark-sweep generation total 458752K, used 259541K [0x00000000dc000000, 0x00000000f8000000, 0x00000000f8000000)"
                    + "\nconcurrent-mark-sweep perm gen total 65536K, used 2621K [0x00000000f8000000, 0x00000000fc000000, 0x0000000100000000)")
                .getBytes());
    final DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_6);
    GCModel model = reader.read();

    assertEquals("GC count", 1, model.size());
    assertEquals("GC pause", 0.0269605, model.getGCPause().getMin(), 0.000000001);
    assertEquals("number of errors", 0, handler.getCount());
  }
  /**
   * 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);
    IMP_LOGGER.addHandler(handler);
    DATA_READER_FACTORY_LOGGER.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(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"));
  }
예제 #3
0
  @Test
  public void testPrintHeapAtGC() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    IMP_LOGGER.addHandler(handler);
    DATA_READER_FACTORY_LOGGER.addHandler(handler);

    final InputStream in = getClass().getResourceAsStream("SampleSun1_6_0PrintHeapAtGC.txt");
    final DataReader reader = new DataReaderSun1_6_0(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());
  }
예제 #4
0
  @Test
  public void testCMSAdaptiveSizePolicy() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    IMP_LOGGER.addHandler(handler);
    DATA_READER_FACTORY_LOGGER.addHandler(handler);

    final InputStream in =
        getClass().getResourceAsStream("SampleSun1_6_0CMSAdaptiveSizePolicy.txt");
    final DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_6);
    GCModel model = reader.read();

    assertEquals("event count", 24, model.size());
    assertEquals("young gc count", 11, model.getGCPause().getN());
    assertEquals("full gc count", 1, model.getFullGCPause().getN());
    assertEquals("number of errors", 0, handler.getCount());
  }
  @Test
  public void testGcPrioPausetime() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    IMP_LOGGER.addHandler(handler);
    DATA_READER_FACTORY_LOGGER.addHandler(handler);

    InputStream in = getInputStream("SampleJRockit1_5_12_gcpriopausetime.txt");
    DataReader reader = new DataReaderJRockit1_5_0(in);
    GCModel model = reader.read();

    assertEquals("count", 10, model.size());

    GCEvent event = (GCEvent) model.get(0);
    assertEquals("timestamp", 6.290, event.getTimestamp(), 0.000001);
    assertEquals("name", Type.JROCKIT_GC.getName(), event.getExtendedType().getName());
    assertEquals("before", 3128161, event.getPreUsed());
    assertEquals("after", 296406, event.getPostUsed());
    assertEquals("total", 3145728, event.getTotal());
    assertEquals("pause", 0.059084, event.getPause(), 0.0000001);

    assertEquals("number of warnings", 6, handler.getCount());
  }