diff options
author | Simon Marlow <marlowsd@gmail.com> | 2015-05-08 15:28:40 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2015-05-11 12:46:17 +0100 |
commit | cf7573b8207bbb17c58612f3345e0b17d74cfb58 (patch) | |
tree | 93321c1def706be49644ac30c05bc5251b041d62 /testsuite | |
parent | 2666ba369f8d3e7d187876b7b602d42f2d6db381 (diff) | |
download | haskell-cf7573b8207bbb17c58612f3345e0b17d74cfb58.tar.gz |
More accurate allocation stats for :set +s
The point of this commit is to make the memory allocation statistic
from :set +s in GHCi a lot more accurate. Currently it uses the total
allocation figure calculated by the RTS, which is only updated during
GC, so can be wrong by an arbitrary amount. The fix is to the the
per-thread allocation counter that was introduced for allocation
limits.
This required changes to the GHC API, because we now have to return
the allocation value from each evaluation. Rather than just change
the API, I introduced a new API and deprecated the old one. The new
one is simpler and more extensible, so hopefully we won't need to make
this transition in the future. See GHC.hs for details.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghc-api/T8628.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/T8639_api.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/apirecomp001/myghc.hs | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/testsuite/tests/ghc-api/T8628.hs b/testsuite/tests/ghc-api/T8628.hs index 203d3282ab..d3b05a9f86 100644 --- a/testsuite/tests/ghc-api/T8628.hs +++ b/testsuite/tests/ghc-api/T8628.hs @@ -24,10 +24,10 @@ main setContext [ IIDecl (simpleImportDecl pRELUDE_NAME) , IIDecl (simpleImportDecl (mkModuleNameFS (fsLit "System.IO")))] runDecls "data X = Y ()" - runStmt "print True" RunToCompletion - gtry $ runStmt "print (Y ())" RunToCompletion :: GhcMonad m => m (Either SomeException RunResult) + execStmt "print True" execOptions + gtry $ execStmt "print (Y ())" execOptions :: GhcMonad m => m (Either SomeException ExecResult) runDecls "data X = Y () deriving Show" _ <- dynCompileExpr "'x'" - runStmt "print (Y ())" RunToCompletion - runStmt "System.IO.hFlush System.IO.stdout" RunToCompletion + execStmt "print (Y ())" execOptions + execStmt "System.IO.hFlush System.IO.stdout" execOptions print "done" diff --git a/testsuite/tests/ghc-api/T8639_api.hs b/testsuite/tests/ghc-api/T8639_api.hs index 2ddfb4919e..36458b8eca 100644 --- a/testsuite/tests/ghc-api/T8639_api.hs +++ b/testsuite/tests/ghc-api/T8639_api.hs @@ -19,8 +19,8 @@ main -- With the next line, you get an "Not in scope" exception. -- If you comment out this runStmt, it runs without error and prints the type. - runStmt "putStrLn (show 3)" RunToCompletion - runStmt "hFlush stdout" RunToCompletion + execStmt "putStrLn (show 3)" execOptions + execStmt "hFlush stdout" execOptions ty <- exprType "T8639_api_a.it" liftIO (putStrLn (showPpr flags ty)) diff --git a/testsuite/tests/ghc-api/apirecomp001/myghc.hs b/testsuite/tests/ghc-api/apirecomp001/myghc.hs index 39545c937d..a21aa47fa6 100644 --- a/testsuite/tests/ghc-api/apirecomp001/myghc.hs +++ b/testsuite/tests/ghc-api/apirecomp001/myghc.hs @@ -44,11 +44,11 @@ main = do setContext [IIModule mod] liftIO $ hFlush stdout -- make sure things above are printed before -- interactive output - r <- runStmt "main" RunToCompletion + r <- execStmt "main" execOptions case r of - RunOk _ -> prn "ok" - RunException _ -> prn "exception" - RunBreak _ _ _ -> prn "breakpoint" + ExecComplete { execResult = Right _ } -> prn "ok" + ExecComplete { execResult = Left _ } -> prn "exception" + ExecBreak{} -> prn "breakpoint" liftIO $ hFlush stdout return () |