Measuring Time - lambda-land/VDBMS GitHub Wiki
Timing Computation
The method coms from:
The approach used for computing timing is referenced from Timing conputations
How to use it:
- add dependency
clock
and import following module:
import System.Directory
import System.Clock
import System.CPUTime
import Text.Printf
- include function time in file
time :: IO t -> IO t
time a = do
start <- getCPUTime
v <- a
end <- getCPUTime
let diff = (fromIntegral (end - start)) / (10^12)
printf "Computation time: %0.5f sec\n" (diff :: Double)
return v
- You can change 0.5 to any number you like.
- use
time
to mesuareg the function execution time
main = do
putStrLn "Starting..."
time $ runTransFilterUnion vqManual p employeeVDB `seq` return ()
putStrLn "Done."