From: simonmar Date: Fri, 29 Jun 2001 09:44:03 +0000 (+0000) Subject: [project @ 2001-06-29 09:44:03 by simonmar] X-Git-Tag: nhc98-1-18-release~1231 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e79cab11f1e7f9487cae451eac20bac70dbb07cf;p=haskell-directory.git [project @ 2001-06-29 09:44:03 by simonmar] merge ghc/lib/std/CPUTime.hsc rev. 1.7 --- diff --git a/System/CPUTime.hsc b/System/CPUTime.hsc index b800e8c..d672817 100644 --- a/System/CPUTime.hsc +++ b/System/CPUTime.hsc @@ -8,7 +8,7 @@ -- Stability : provisional -- Portability : portable -- --- $Id: CPUTime.hsc,v 1.1 2001/06/28 14:15:04 simonmar Exp $ +-- $Id: CPUTime.hsc,v 1.2 2001/06/29 09:44:03 simonmar Exp $ -- -- The standard CPUTime library. -- @@ -93,14 +93,14 @@ foreign import unsafe times :: Ptr CTms -> CClock pid <- getCurrentProcess ok <- getProcessTimes pid p_creationTime p_exitTime p_kernelTime p_userTime if toBool ok then do - ut <- ft2usecs p_userTime - kt <- ft2usecs p_kernelTime + ut <- ft2psecs p_userTime + kt <- ft2psecs p_kernelTime return (fromIntegral (ut + kt)) else return 0 - where ft2usecs ft = do + where ft2psecs ft = do high <- (#peek FILETIME,dwHighDateTime) ft :: IO CLong low <- (#peek FILETIME,dwLowDateTime) ft :: IO CLong - return (high * (2^32) + low) + return (((fromIntegral high) * (2^32) + (fromIntegral low)) * 100000) -- ToDo: pin down elapsed times to just the OS thread(s) that -- are evaluating/managing Haskell code.