diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2014-08-04 08:10:33 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-08-04 08:10:33 -0500 |
commit | f6866824ce5cdf5359f0cad78c49d65f6d43af12 (patch) | |
tree | d6f4c1f81420a2a24aab543cd991fcf74987ea26 /compiler/main/GhcMake.hs | |
parent | 65e5dbcd3971cb3ef5b9073096e5d063034b90c1 (diff) | |
download | haskell-f6866824ce5cdf5359f0cad78c49d65f6d43af12.tar.gz |
ghc --make: add nicer names to RTS threads (threaded IO manager, make workers)
Summary:
The patch names most of RTS threads
and ghc (the tool) threads.
It makes nicer debug and eventlog output for ghc itself.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: ran debugged ghc under '+RTS -Ds'
Reviewers: simonmar, austin
Reviewed By: austin
Subscribers: phaskell, simonmar, relrod, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D101
Diffstat (limited to 'compiler/main/GhcMake.hs')
-rw-r--r-- | compiler/main/GhcMake.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 33f163caed..0c63203d4c 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -63,6 +63,7 @@ import qualified Data.Set as Set import qualified FiniteMap as Map ( insertListWith ) import Control.Concurrent ( forkIOWithUnmask, killThread ) +import qualified GHC.Conc as CC import Control.Concurrent.MVar import Control.Concurrent.QSem import Control.Exception @@ -80,6 +81,11 @@ import System.IO.Error ( isDoesNotExistError ) import GHC.Conc ( getNumProcessors, getNumCapabilities, setNumCapabilities ) +label_self :: String -> IO () +label_self thread_name = do + self_tid <- CC.myThreadId + CC.labelThread self_tid thread_name + -- ----------------------------------------------------------------------------- -- Loading the program @@ -744,10 +750,18 @@ parUpsweep n_jobs old_hpt stable_mods cleanup sccs = do | ((ms,mvar,_),idx) <- comp_graph_w_idx ] + liftIO $ label_self "main --make thread" -- For each module in the module graph, spawn a worker thread that will -- compile this module. let { spawnWorkers = forM comp_graph_w_idx $ \((mod,!mvar,!log_queue),!mod_idx) -> forkIOWithUnmask $ \unmask -> do + liftIO $ label_self $ unwords + [ "worker --make thread" + , "for module" + , show (moduleNameString (ms_mod_name mod)) + , "number" + , show mod_idx + ] -- Replace the default log_action with one that writes each -- message to the module's log_queue. The main thread will -- deal with synchronously printing these messages. |