1 package org.slf4j.impl;
2
3 import junit.framework.TestCase;
4
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
7 import org.slf4j.helpers.BogoPerf;
8
9 public class PerfTest extends TestCase {
10
11 static long REFERENCE_BIPS = 9000;
12
13 public PerfTest(String name) {
14 super(name);
15 }
16
17 protected void setUp() throws Exception {
18 super.setUp();
19 }
20
21 protected void tearDown() throws Exception {
22 super.tearDown();
23 }
24
25 public void testBug72() {
26
27 int LEN = 1000*1000*10;
28 debugLoop(LEN);
29 double avg = debugLoop(LEN);
30 long referencePerf = 93;
31 BogoPerf.assertDuration(avg, referencePerf, REFERENCE_BIPS);
32
33
34
35
36
37 }
38
39 double debugLoop(int len) {
40 Logger logger = LoggerFactory.getLogger(PerfTest.class);
41 long start = System.currentTimeMillis();
42 for (int i = 0; i < len; i++) {
43 logger.debug("hello");
44 }
45
46 long end = System.currentTimeMillis();
47
48 long duration = end - start;
49 return duration;
50 }
51
52 }