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