diff options
| author | krasimir <krasimir@chalmers.se> | 2008-04-29 09:43:35 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2008-04-29 09:43:35 +0000 |
| commit | 6550daf31cd454bca62f2b7d900414ef2150b262 (patch) | |
| tree | 0c7aeb4420cf5a54a626fdc0748a062bdc9f5cd4 /src/GF | |
| parent | 4e4734f5a3e8af4270ae5f7c75a7a50490737838 (diff) | |
let the putPointE print the time in msec
Diffstat (limited to 'src/GF')
| -rw-r--r-- | src/GF/Devel/Compile.hs | 4 | ||||
| -rw-r--r-- | src/GF/Devel/UseIO.hs | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/GF/Devel/Compile.hs b/src/GF/Devel/Compile.hs index bcf8ac8c7..0655913e1 100644 --- a/src/GF/Devel/Compile.hs +++ b/src/GF/Devel/Compile.hs @@ -89,12 +89,12 @@ compileModule opts1 env file = do compileOne :: Options -> CompileEnv -> FullPath -> IOE CompileEnv compileOne opts env@(_,srcgr,_) file = do - let putp s = putPointE opts ("\n" ++ s) + let putp s = putPointE opts s let putpp = putPointEsil opts let putpOpt v m act | oElem beVerbose opts = putp v act | oElem beSilent opts = putpp v act - | otherwise = ioeIO (putStrFlush ("\n" ++ m)) >> act + | otherwise = ioeIO (putStrFlush m) >> act let gf = takeExtensions file let path = dropFileName file diff --git a/src/GF/Devel/UseIO.hs b/src/GF/Devel/UseIO.hs index 8ffe06605..afbf00efd 100644 --- a/src/GF/Devel/UseIO.hs +++ b/src/GF/Devel/UseIO.hs @@ -26,6 +26,7 @@ import System.IO.Error import System.Environment import System.CPUTime import Control.Monad +import Control.Exception(evaluate) import qualified Data.ByteString.Char8 as BS #ifdef mingw32_HOST_OS @@ -252,10 +253,12 @@ putPointEgen :: (Options -> Bool) -> Options -> String -> IOE a -> IOE a putPointEgen cond opts msg act = do let ve x = if cond opts then return () else x ve $ ioeIO $ putStrFlush msg - a <- act ---- ve $ ioeIO $ putShow' id a --- replace by a statistics command - ve $ ioeIO $ putStrFlush " " --- ve $ ioeIO $ putCPU + + t1 <- ioeIO $ getCPUTime + a <- act >>= ioeIO . evaluate + t2 <- ioeIO $ getCPUTime + + ve $ ioeIO $ putStrLnFlush (' ' : show ((t2 - t1) `div` 1000000000) ++ " msec") return a |
