diff options
| author | Ben Gamari <bgamari.foss@gmail.com> | 2016-03-23 16:11:45 +0100 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2016-03-24 10:53:27 +0100 |
| commit | 8048d51be0676627b417c128af0b0c352b75c537 (patch) | |
| tree | 0d4ae8449cf93b94078587e6793e13dcd4a5ac76 /compiler/ghci/ByteCodeGen.hs | |
| parent | da3b29bd1768d717753b7d1642e0e4e97750ae7b (diff) | |
| download | haskell-8048d51be0676627b417c128af0b0c352b75c537.tar.gz | |
ErrUtils: Add timings to compiler phases
This adds timings and allocation figures to the compiler's output when
run with `-v2` in an effort to ease performance analysis.
Todo:
* Documentation
* Where else should we add these?
* Perhaps we should remove some of the now-arguably-redundant
`showPass` occurrences where they are
* Must we force more?
* Perhaps we should place this behind a `-ftimings` instead of `-v2`
Test Plan: `ghc -v2 Test.hs`, look at the output
Reviewers: hvr, goldfire, simonmar, austin
Reviewed By: simonmar
Subscribers: angerman, michalt, niteria, ezyang, thomie
Differential Revision: https://phabricator.haskell.org/D1959
Diffstat (limited to 'compiler/ghci/ByteCodeGen.hs')
| -rw-r--r-- | compiler/ghci/ByteCodeGen.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/ghci/ByteCodeGen.hs b/compiler/ghci/ByteCodeGen.hs index ecbb8e3a8a..da52b54240 100644 --- a/compiler/ghci/ByteCodeGen.hs +++ b/compiler/ghci/ByteCodeGen.hs @@ -74,9 +74,9 @@ byteCodeGen :: HscEnv -> Maybe ModBreaks -> IO CompiledByteCode byteCodeGen hsc_env this_mod binds tycs mb_modBreaks - = do let dflags = hsc_dflags hsc_env - showPass dflags "ByteCodeGen" - + = withTiming (pure dflags) + (text "ByteCodeGen"<+>brackets (ppr this_mod)) + (const ()) $ do let flatBinds = [ (bndr, simpleFreeVars rhs) | (bndr, rhs) <- flattenBinds binds] @@ -95,6 +95,7 @@ byteCodeGen hsc_env this_mod binds tycs mb_modBreaks (case modBreaks of Nothing -> Nothing Just mb -> Just mb{ modBreaks_breakInfo = breakInfo }) + where dflags = hsc_dflags hsc_env -- ----------------------------------------------------------------------------- -- Generating byte code for an expression @@ -105,9 +106,9 @@ coreExprToBCOs :: HscEnv -> CoreExpr -> IO UnlinkedBCO coreExprToBCOs hsc_env this_mod expr - = do let dflags = hsc_dflags hsc_env - showPass dflags "ByteCodeGen" - + = withTiming (pure dflags) + (text "ByteCodeGen"<+>brackets (ppr this_mod)) + (const ()) $ do -- create a totally bogus name for the top-level BCO; this -- should be harmless, since it's never used for anything let invented_name = mkSystemVarName (mkPseudoUniqueE 0) (fsLit "ExprTopLevel") @@ -126,7 +127,7 @@ coreExprToBCOs hsc_env this_mod expr dumpIfSet_dyn dflags Opt_D_dump_BCOs "Proto-BCOs" (ppr proto_bco) assembleOneBCO hsc_env proto_bco - + where dflags = hsc_dflags hsc_env -- The regular freeVars function gives more information than is useful to -- us here. simpleFreeVars does the impedence matching. |
