diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2010-08-23 08:51:40 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2010-08-23 08:51:40 +0000 |
commit | b3982fcf27f9a4553152dccd1e3c6df68ebe0f67 (patch) | |
tree | 6080ab84c70f726ce9c3fb81c529242027a6a99e /src | |
parent | fc735859fff7f611544103b310e437ba2c8e4471 (diff) | |
download | scala-b3982fcf27f9a4553152dccd1e3c6df68ebe0f67.tar.gz scala-b3982fcf27f9a4553152dccd1e3c6df68ebe0f67.tar.bz2 scala-b3982fcf27f9a4553152dccd1e3c6df68ebe0f67.zip |
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).
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/testing/Benchmark.scala | 7 |
1 files changed, 7 insertions, 0 deletions
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. */ |