[Git][ghc/ghc][wip/time-splices] compiler: Time splice execution
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Mon Jun 10 10:28:47 UTC 2024
Ben Gamari pushed to branch wip/time-splices at Glasgow Haskell Compiler / GHC
Commits:
50a8cc33 by Ben Gamari at 2024-06-10T06:28:38-04:00
compiler: Time splice execution
- - - - -
2 changed files:
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Tc/Utils/Monad.hs
Changes:
=====================================
compiler/GHC/Rename/Splice.hs
=====================================
@@ -360,7 +360,8 @@ runRnSplice :: UntypedSpliceFlavour
-> HsUntypedSplice GhcRn
-> TcRn (res, [ForeignRef (TH.Q ())])
runRnSplice flavour run_meta ppr_res splice
- = do { hooks <- hsc_hooks <$> getTopEnv
+ = withTimingTcRn (text "splice") (\(x,_) -> () `seq` x)
+ do { hooks <- hsc_hooks <$> getTopEnv
; splice' <- case runRnSpliceHook hooks of
Nothing -> return splice
Just h -> h splice
=====================================
compiler/GHC/Tc/Utils/Monad.hs
=====================================
@@ -43,6 +43,7 @@ module GHC.Tc.Utils.Monad(
-- * Debugging
traceTc, traceRn, traceOptTcRn, dumpOptTcRn,
dumpTcRn,
+ withTTimingTcRn,
getNamePprCtx,
printForUserTcRn,
traceIf, traceOptIf,
@@ -852,6 +853,15 @@ dumpTcRn useUserStyle flag title fmt doc = do
else mkDumpStyle name_ppr_ctx
liftIO $ logDumpFile logger sty flag title fmt real_doc
+withTimingTcRn
+ :: SDoc -- ^ name of the phase
+ -> (a -> ()) -- ^ a function to force the result
+ -> TcRn a
+ -> TcRn a
+withTimingTcRn what force action = do
+ logger <- getLogger
+ withTiming logger what force action
+
-- | Add current location if -dppr-debug
-- (otherwise the full location is usually way too much)
wrapDocLoc :: SDoc -> TcRn SDoc
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/50a8cc330117e3771e56777aedc28ae48fe79619
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/50a8cc330117e3771e56777aedc28ae48fe79619
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240610/5538a7e1/attachment-0001.html>
More information about the ghc-commits
mailing list