2 % (c) The GRASP/AQUA Project, Glasgow University, 1995
4 \section[LibCPUTime]{Haskell 1.3 CPU Time Library}
7 module LibCPUTime where
11 getCPUTime :: IO Integer
13 _ccall_ getCPUTime `thenPrimIO` \ ptr@(A# ptr#) ->
14 if ptr /= ``NULL'' then
15 return (fromInt (I# (indexIntOffAddr# ptr# 0#)) * 1000000000 +
16 fromInt (I# (indexIntOffAddr# ptr# 1#)) +
17 fromInt (I# (indexIntOffAddr# ptr# 2#)) * 1000000000 +
18 fromInt (I# (indexIntOffAddr# ptr# 3#)))
20 failWith (UnsupportedOperation "can't get CPU time")
24 Computation $getCPUTime$ returns the number of nanoseconds CPU time
25 used by the current program. The precision of this result is
26 implementation-dependent.