aboutsummaryrefslogtreecommitdiff
path: root/tests/bench/transactional/Runner.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bench/transactional/Runner.scala')
-rw-r--r--tests/bench/transactional/Runner.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/bench/transactional/Runner.scala b/tests/bench/transactional/Runner.scala
new file mode 100644
index 000000000..48da7ff12
--- /dev/null
+++ b/tests/bench/transactional/Runner.scala
@@ -0,0 +1,25 @@
+package transactional
+import System.nanoTime
+
+class Runner(name: String, bench: Benchmark, expected: Int) {
+
+ val numIters = 10000000
+ val numTests = 5
+
+ def run(): Unit = {
+ val start = nanoTime
+ var cnt = 0
+ var i = 0
+ while (i < numIters) {
+ cnt += bench.run()
+ i += 1
+ }
+ assert(cnt == expected * numIters)
+ val duration = nanoTime - start
+ println(s"$name in ${duration / 1000000}ms")
+ }
+
+ def main(args: Array[String]) =
+ for (i <- 0 until numTests)
+ run()
+}