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/llvmGen | |
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/llvmGen')
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen.hs | 3 | ||||
-rw-r--r-- | compiler/llvmGen/LlvmMangler.hs | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs index 872ad8ce78..fd13de6ec6 100644 --- a/compiler/llvmGen/LlvmCodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen.hs @@ -42,7 +42,8 @@ llvmCodeGen :: DynFlags -> Handle -> UniqSupply -> Stream.Stream IO RawCmmGroup () -> IO () llvmCodeGen dflags h us cmm_stream - = do bufh <- newBufHandle h + = withTiming (pure dflags) (text "LLVM CodeGen") (const ()) $ do + bufh <- newBufHandle h -- Pass header showPass dflags "LLVM CodeGen" diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs index 6ad62d067a..acf344fe2d 100644 --- a/compiler/llvmGen/LlvmMangler.hs +++ b/compiler/llvmGen/LlvmMangler.hs @@ -13,7 +13,8 @@ module LlvmMangler ( llvmFixupAsm ) where import DynFlags ( DynFlags, targetPlatform ) import Platform ( platformArch, Arch(..) ) -import ErrUtils ( showPass ) +import ErrUtils ( withTiming ) +import Outputable ( text ) import Control.Exception import qualified Data.ByteString.Char8 as B @@ -21,8 +22,8 @@ import System.IO -- | Read in assembly file and process llvmFixupAsm :: DynFlags -> FilePath -> FilePath -> IO () -llvmFixupAsm dflags f1 f2 = {-# SCC "llvm_mangler" #-} do - showPass dflags "LLVM Mangler" +llvmFixupAsm dflags f1 f2 = {-# SCC "llvm_mangler" #-} + withTiming (pure dflags) (text "LLVM Mangler") id $ withBinaryFile f1 ReadMode $ \r -> withBinaryFile f2 WriteMode $ \w -> do go r w hClose r |