diff options
author | Burak Emir <emir@epfl.ch> | 2007-06-16 18:27:50 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-06-16 18:27:50 +0000 |
commit | 6bc98cf8aff5fe7e595b1ec11712aa95356142aa (patch) | |
tree | 3c6e416813a73a297a9e74a09838f9e3963aa34c /src/library | |
parent | 225fac5af513f7bc7edd7b7e8e262ab151ef823e (diff) | |
download | scala-6bc98cf8aff5fe7e595b1ec11712aa95356142aa.tar.gz scala-6bc98cf8aff5fe7e595b1ec11712aa95356142aa.tar.bz2 scala-6bc98cf8aff5fe7e595b1ec11712aa95356142aa.zip |
added prefix method, for more useful Benchmark ...
added prefix method, for more useful Benchmark output
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/testing/Benchmark.scala | 7 |
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) |