JUnitBenchmarks will turn your JUnit4 tests into performance micro-benchmarks in a matter of a few simple annotations. It can also generate per-run and historical charts from the data it collects.
public class WhatsMyAverageRunningTime extends AbstractBenchmark {
private final static Random rnd = new Random();
@Test
public void question() throws Exception {
Thread.sleep(rnd.nextInt(100));
}
}
And the answer, after running in Eclipse:
(Yes, we know this one could be analytically determined :)