From 6bc98cf8aff5fe7e595b1ec11712aa95356142aa Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Sat, 16 Jun 2007 18:27:50 +0000 Subject: added prefix method, for more useful Benchmark ... added prefix method, for more useful Benchmark output --- src/library/scala/testing/Benchmark.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit v1.2.3