summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/testing/Benchmark.scala7
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.
*/