From b3982fcf27f9a4553152dccd1e3c6df68ebe0f67 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Mon, 23 Aug 2010 08:51:40 +0000 Subject: Added an overridable setUp method that is calle... Added an overridable setUp method that is called prior to each benchmarking (but whose execution time is not measured). --- src/library/scala/testing/Benchmark.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/library/scala/testing/Benchmark.scala b/src/library/scala/testing/Benchmark.scala index 8e29d740db..035c1b41f5 100644 --- a/src/library/scala/testing/Benchmark.scala +++ b/src/library/scala/testing/Benchmark.scala @@ -52,6 +52,7 @@ trait Benchmark { */ def runBenchmark(noTimes: Int): List[Long] = for (i <- List.range(1, noTimes + 1)) yield { + setUp val startTime = Platform.currentTime var i = 0; while (i < multiplier) { run() @@ -63,6 +64,12 @@ trait Benchmark { stopTime - startTime } + /** Prepare any data needed by the benchmark, but which should not + * be measured. + */ + def setUp { + } + /** a string that is written at the beginning of the output line * that contains the timings. By default, this is the class name. */ -- cgit v1.2.3