2019-05-08 21:47:20 +03:00
|
|
|
module Main where
|
|
|
|
|
|
|
|
import Prelude
|
|
|
|
import Control.Lens
|
|
|
|
|
2019-05-08 23:51:04 +03:00
|
|
|
import Control.Concurrent.MVar
|
|
|
|
import Control.Concurrent (threadDelay, forkIO)
|
|
|
|
import Control.Monad (replicateM_, when)
|
2019-05-08 21:47:20 +03:00
|
|
|
import Data.LargeWord (Word128, LargeKey(..))
|
|
|
|
|
|
|
|
import qualified Urbit.Behn as Behn
|
|
|
|
import qualified Urbit.Time as Time
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2019-05-09 02:57:34 +03:00
|
|
|
bench :: Behn.Behn -> IO ()
|
2019-05-08 21:47:20 +03:00
|
|
|
bench behn = do
|
|
|
|
now <- Time.now
|
|
|
|
|
2019-05-09 02:57:34 +03:00
|
|
|
let wen = Time.addGap now (2 ^. from Time.milliSecs)
|
|
|
|
Behn.doze behn (Just wen)
|
2019-05-08 21:47:20 +03:00
|
|
|
|
2019-05-09 02:57:34 +03:00
|
|
|
() <- Behn.wait behn
|
2019-05-08 21:47:20 +03:00
|
|
|
aft <- Time.now
|
|
|
|
|
2019-05-09 02:57:34 +03:00
|
|
|
print (Time.gap wen aft ^. Time.milliSecs)
|
2019-05-08 21:47:20 +03:00
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
|
|
|
behn <- Behn.init
|
|
|
|
|
2019-05-09 02:57:34 +03:00
|
|
|
putStrLn "<bench>"
|
|
|
|
replicateM_ 50 (bench behn)
|
|
|
|
putStrLn "</bench>"
|