@@ -104,20 +104,11 @@ run profiled = withProjectRoot "." $ \root -> do
104104 let exeSource =
105105 unlines $
106106 [ "module Main where"
107− , "import Control.Concurrent"
108− , "import Control.Monad.Fix"
107+ , "import Control.Exception"
109108 , "import Reflex.Profiled" ]
110109 <> obRunImports <>
111110 [ "main :: IO ()"
112− , "main = do"
113− , " forkIO $ fix $ \\rec -> do"
114− -- TODO: make this filename customizable
115− , " writeProfilingData \"" <> profileBaseName <> ".rprof\""
116− -- write every .1 seconds.
117− -- TODO: perhaps it should only write once at the end of ecah run
118− , " threadDelay 10000"
119− , " rec"
120− , " " <> obRunExpr]
111+ , "main = " <> obRunExpr <> " `finally` writeProfilingData \"" <> profileBaseName <> ".rprof\"" ]
121112 -- Sane flags to enable by default, enable time profiling +
122113 -- closure heap profiling.
123114 rtsFlags = [ "+RTS", "-p", "-po" <> profileBaseName, "-hc", "-RTS" ]