summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2010-08-23 08:51:40 +0000
committerIulian Dragos <jaguarul@gmail.com>2010-08-23 08:51:40 +0000
commitb3982fcf27f9a4553152dccd1e3c6df68ebe0f67 (patch)
tree6080ab84c70f726ce9c3fb81c529242027a6a99e /src/library
parentfc735859fff7f611544103b310e437ba2c8e4471 (diff)
downloadscala-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/library')
-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.
*/