summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Error.hs
diff options
context:
space:
mode:
authorNorman Ramsey <nr@cs.tufts.edu>2022-02-07 10:42:36 -0500
committerCheng Shao <astrohavoc@gmail.com>2022-05-21 03:11:04 +0000
commit4aa3c5bde8c54f6ab8cbb2a574f7654590c077ca (patch)
tree43e79b6f797f12a3eb040252a20ac80659c55514 /compiler/GHC/Utils/Error.hs
parent36b8a57cb30c1374cce749b6f1554a2d438336b9 (diff)
downloadhaskell-4aa3c5bde8c54f6ab8cbb2a574f7654590c077ca.tar.gz
Change `Backend` type and remove direct dependencieswip/backend-as-record
With this change, `Backend` becomes an abstract type (there are no more exposed value constructors). Decisions that were formerly made by asking "is the current back end equal to (or different from) this named value constructor?" are now made by interrogating the back end about its properties, which are functions exported by `GHC.Driver.Backend`. There is a description of how to migrate code using `Backend` in the user guide. Clients using the GHC API can find a backdoor to access the Backend datatype in GHC.Driver.Backend.Internal. Bumps haddock submodule. Fixes #20927
Diffstat (limited to 'compiler/GHC/Utils/Error.hs')
-rw-r--r--compiler/GHC/Utils/Error.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/Error.hs b/compiler/GHC/Utils/Error.hs
index ef6dd4f07d..8c044c5af9 100644
--- a/compiler/GHC/Utils/Error.hs
+++ b/compiler/GHC/Utils/Error.hs
@@ -58,6 +58,7 @@ module GHC.Utils.Error (
ghcExit,
prettyPrintGhcErrors,
traceCmd,
+ traceSystoolCommand,
sortMsgBag
) where
@@ -460,6 +461,20 @@ traceCmd logger phase_name cmd_line action = do
-- And run it!
action `catchIO` handle_exn
+
+-- * Tracing utility
+
+-- | Record in the eventlog when the given tool command starts
+-- and finishes, prepending the given 'String' with
+-- \"systool:\", to easily be able to collect and process
+-- all the systool events.
+--
+-- For those events to show up in the eventlog, you need
+-- to run GHC with @-v2@ or @-ddump-timings@.
+traceSystoolCommand :: Logger -> String -> IO a -> IO a
+traceSystoolCommand logger tool = withTiming logger (text "systool:" <> text tool) (const ())
+
+
{- Note [withTiming]
~~~~~~~~~~~~~~~~~~~~