X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Flib%2Fhaskell-1.3%2FLibCPUTime.lhs;fp=ghc%2Flib%2Fhaskell-1.3%2FLibCPUTime.lhs;h=c3db93ed458d513fd8a8ef5de6a4d001f72d3c66;hb=e7d21ee4f8ac907665a7e170c71d59e13a01da09;hp=0000000000000000000000000000000000000000;hpb=e48474bff05e6cfb506660420f025f694c870d38;p=ghc-hetmet.git diff --git a/ghc/lib/haskell-1.3/LibCPUTime.lhs b/ghc/lib/haskell-1.3/LibCPUTime.lhs new file mode 100644 index 0000000..c3db93e --- /dev/null +++ b/ghc/lib/haskell-1.3/LibCPUTime.lhs @@ -0,0 +1,31 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1995 +% +\section[LibCPUTime]{Haskell 1.3 CPU Time Library} + +\begin{code} +module LibCPUTime where + +import PreludeGlaST + +getCPUTime :: IO Integer +getCPUTime = + _ccall_ getCPUTime `thenPrimIO` \ ptr@(A# ptr#) -> + if ptr /= ``NULL'' then + return (fromInt (I# (indexIntOffAddr# ptr# 0#)) * 1000000000 + + fromInt (I# (indexIntOffAddr# ptr# 1#)) + + fromInt (I# (indexIntOffAddr# ptr# 2#)) * 1000000000 + + fromInt (I# (indexIntOffAddr# ptr# 3#))) + else + failWith (UnsupportedOperation "can't get CPU time") + +\end{code} + +Computation $getCPUTime$ returns the number of nanoseconds CPU time +used by the current program. The precision of this result is +implementation-dependent. + + + + +