Guest User

Untitled

a guest
May 27th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. threadDelay :: Int -> IO () Source
  2. Suspends the current thread for a given number of microseconds (GHC only).
  3.  
  4. There is no guarantee that the thread will be rescheduled promptly when the delay has expired, but the thread will ***never continue to run earlier than specified***.
  5.  
  6.  
  7. ---
  8.  
  9. module Main where
  10.  
  11. import Criterion.Main
  12. import Control.Concurrent
  13.  
  14. sleep1 = do
  15. threadDelay 1000000
  16. return ()
  17.  
  18. main :: IO ()
  19. main = defaultMain [bench "1 sec delay" $ whnfIO sleep1 ]
  20.  
  21. ---
  22. warming up
  23. estimating clock resolution...
  24. mean is 9.540081 us (80001 iterations)
  25. found 1384 outliers among 79997 samples (1.7%)
  26. 1221 (1.5%) high severe
  27. estimating cost of a clock call...
  28. mean is 193.1040 ns (62 iterations)
  29. found 4 outliers among 62 samples (6.5%)
  30. 1 (1.6%) low severe
  31. 1 (1.6%) low mild
  32. 2 (3.2%) high severe
  33.  
  34. benchmarking 1 sec delay
  35. collecting 100 samples, 1 iterations each, in estimated 100.1319 s
  36. bootstrapping with 100000 resamples
  37. mean: 1.001000 s, lb 1.000953 s, ub 1.001030 s, ci 0.950
  38. std dev: 192.3861 us, lb 131.5291 us, ub 265.3644 us, ci 0.950
  39. found 14 outliers among 100 samples (14.0%)
  40. 10 (10.0%) low severe
  41. 3 (3.0%) high mild
  42. 1 (1.0%) high severe
  43. variance introduced by outliers: 0.990%
  44. variance is unaffected by outliers
Add Comment
Please, Sign In to add comment