示例#1
0
 private static void doTestRun(final NoGcLogger logger, final int repetitions, final int n) {
   startTime[n] = System.currentTimeMillis();
   final long start = System.nanoTime();
   for (int i = 0; i < repetitions; i++) {
     logger.log(
         "Test message str={}, double={}, int={}, obj={}", "abc", box(i / 2.5), box(i), "XYX");
     // logger.log("Test message str={}, double={}, int={}, obj={}", "abc", (i / 2.5), (i),
     // logger);
   }
   duration[n] = System.nanoTime() - start;
   checksums[n] = logger.appender.checksum;
   logger.appender.checksum = 0;
 }
示例#2
0
  private static void doTestRunBoth(
      final ClassicLogger classic, final NoGcLogger nogc, final int repetitions, final int n) {
    startTime[n] = System.currentTimeMillis();
    final long start = System.nanoTime();
    for (int i = 0; i < repetitions; i++) {
      classic.log("Test message str={}, double={}, int={}, obj={}", "abc", i / 2.5, i, "XYX");
      nogc.log(
          "Test message str={}, double={}, int={}, obj={}", "abc", box(i / 2.5), box(i), "XYX");

      if (classic.appender.checksum != nogc.appender.checksum) {
        throw new IllegalStateException();
      }
    }
    duration[n] = System.nanoTime() - start;
  }