File: benchmarks.hs

package info (click to toggle)
haskell-clock 0.8.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104 kB
  • sloc: haskell: 178; ansic: 90; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{-# language CPP #-}
module Main (main) where

import Criterion.Main
import System.Clock

#if MIN_VERSION_base(4,11,0)
import GHC.Clock
#endif

main :: IO ()
main = defaultMain [
    bgroup "getTime" [
        bench "Monotonic" $ whnfIO (getTime Monotonic)
      , bench "Realtime" $ whnfIO (getTime Realtime)
      , bench "ProcessCPUTime" $ whnfIO (getTime ProcessCPUTime)
      , bench "ThreadCPUTime" $ whnfIO (getTime ThreadCPUTime)
      , bench "MonotonicRaw" $ whnfIO (getTime MonotonicRaw)
      , bench "Boottime" $ whnfIO (getTime Boottime)
      , bench "MonotonicCoarse" $ whnfIO (getTime MonotonicCoarse)
      , bench "RealtimeCoarse" $ whnfIO (getTime RealtimeCoarse)
      ]
#if MIN_VERSION_base(4,11,0)
  , bench "GHC.Clock.getMonotonicTimeNSec" $ whnfIO getMonotonicTimeNSec
#endif
  ]