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, 6 insertions, 1 deletions
diff --git a/src/library/scala/testing/Benchmark.scala b/src/library/scala/testing/Benchmark.scala
index 7542635f5b..005942e3df 100644
--- a/src/library/scala/testing/Benchmark.scala
+++ b/src/library/scala/testing/Benchmark.scala
@@ -64,6 +64,11 @@ trait Benchmark {
stopTime - startTime
}
+ /** a string that is written at the beginning of the output line
+ * that contains the timings. By default, this is the class name.
+ */
+ def prefix: String = getClass().getName()
+
/**
* The entry point. It takes two arguments: the number of
* consecutive runs, and the name of a log file where to
@@ -74,7 +79,7 @@ trait Benchmark {
val logFile = new java.io.FileWriter(args(1), true) // append, not overwrite
if (args.length >= 3)
multiplier = args(2).toInt
- logFile.write(getClass().getName())
+ logFile.write(prefix)
for (t <- runBenchmark(args(0).toInt))
logFile.write("\t\t" + t)