summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2009-11-09 15:24:10 +0000
committerIulian Dragos <jaguarul@gmail.com>2009-11-09 15:24:10 +0000
commite9ce2c085b0c4d040f8937fbcf0e8bab532a270a (patch)
treede0fdef5b2ea754d6ae93db381ead9bcbc8f21f6
parent43ad0dea06b14b31769ff60f0b428ba597f96559 (diff)
downloadscala-e9ce2c085b0c4d040f8937fbcf0e8bab532a270a.tar.gz
scala-e9ce2c085b0c4d040f8937fbcf0e8bab532a270a.tar.bz2
scala-e9ce2c085b0c4d040f8937fbcf0e8bab532a270a.zip
Made Benchmarks use standard output instead of ...
Made Benchmarks use standard output instead of requiring a file name on the command line
-rw-r--r--src/library/scala/testing/Benchmark.scala23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/library/scala/testing/Benchmark.scala b/src/library/scala/testing/Benchmark.scala
index 94722621b3..7d2da0633b 100644
--- a/src/library/scala/testing/Benchmark.scala
+++ b/src/library/scala/testing/Benchmark.scala
@@ -70,18 +70,16 @@ trait Benchmark {
def prefix: String = getClass().getName()
/**
- * The entry point. It takes two arguments (n), (name)
+ * The entry point. It takes two arguments (n),
* and an optional argument multiplier (mult).
- * (n) is the number of consecutive runs, (name) the name
- * of a log file where to append the times.
- * if (mult) is present, the same thing is repeated (mult)
+ * (n) is the number of consecutive runs,
+ * if (mult) is present, the n runs are repeated (mult)
* times.
*/
def main(args: Array[String]) {
- if (args.length > 1) {
- val logFile = new java.io.FileWriter(args(1), true) // append, not overwrite
- if (args.length >= 3)
- multiplier = args(2).toInt
+ if (args.length > 0) {
+ val logFile = new java.io.OutputStreamWriter(System.out)
+ if (args.length > 1) multiplier = args(1).toInt
logFile.write(prefix)
for (t <- runBenchmark(args(0).toInt))
logFile.write("\t\t" + t)
@@ -89,8 +87,13 @@ trait Benchmark {
logFile.write(Platform.EOL)
logFile.flush()
} else {
- Console.println("Usage: scala benchmarks.program <runs> <logfile>")
- Console.println(" or: scala benchmarks.program <runs> <logfile> <multiplier>")
+ println("Usage: scala benchmarks.program <runs> ")
+ println(" or: scala benchmarks.program <runs> <multiplier>")
+ println("""
+ The benchmark is run <runs> times, forcing a garbage collection between runs. The optional
+ <multiplier> causes the benchmark to be repeated <multiplier> times, each time for <runs>
+ executions.
+ """)
}
}
}