Added an overridable setUp method that is called prior to each benchmarking (but whose execution time is not measured).

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@22806 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
dragos 2010-08-23 08:51:40 +00:00
parent 89965245bc
commit f7b7ad5894
1 changed files with 7 additions and 0 deletions

View File

@ -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.
*/