From 5c90505fe7b6566049bead5e36a5e3f73d844413 Mon Sep 17 00:00:00 2001 From: nasr Date: Wed, 26 Nov 2025 23:11:25 +0100 Subject: chore: file refactor, imported zio next steps are running the threads multithreaded and measuring for errors --- src/Tools/Benchmark.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/Tools/Benchmark.scala (limited to 'src/Tools') diff --git a/src/Tools/Benchmark.scala b/src/Tools/Benchmark.scala new file mode 100644 index 0000000..a0b388b --- /dev/null +++ b/src/Tools/Benchmark.scala @@ -0,0 +1,17 @@ +package com.nsrddyn.tools + +class Benchmark { + /* + * Calculate the time between the start of the execution of the function and the end + * */ + def measureTime(work: => Unit): Long = { + + val start = System.nanoTime() + work + val end = System.nanoTime() + end - start + } + + // TODO: map this to an actual precision value + def measurePrecision(work: => Boolean, expectedResult: Boolean): Unit = if work == expectedResult then println(true) else println(false) +} -- cgit v1.2.3-70-g09d2