summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/T5644/Util.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rts/T5644/Util.hs')
-rw-r--r--testsuite/tests/rts/T5644/Util.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/rts/T5644/Util.hs b/testsuite/tests/rts/T5644/Util.hs
new file mode 100644
index 0000000000..b97e55c255
--- /dev/null
+++ b/testsuite/tests/rts/T5644/Util.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE BangPatterns #-}
+
+module Util where
+
+import Data.Time
+-- import Data.List.Split (splitEvery)
+
+import Conf
+
+timed act = do
+ putStrLn ""
+ t0 <- getCurrentTime
+ !v <- act
+ t1 <- getCurrentTime
+ let td = diffUTCTime t1 t0
+ putStrLn $ "Action time: " ++ show td
+ return (v,td)
+
+splitEvery _ [] = []
+splitEvery n xs = let (lxs,rxs) = splitAt n xs in lxs : splitEvery n rxs
+
+runTest :: (IO ()) -> IO ()
+runTest test = do
+ (_, t) <- timed test
+ let format x = unwords . reverse . map reverse . splitEvery 3 . reverse . show $ x
+ val = format (round (fromIntegral iTERATIONS / realToFrac t :: Double) :: Integer)
+
+ putStr "OpsPerSecond: "
+ putStrLn val \ No newline at end of file