Skip to content

Commit

Permalink
Add extra logging for GC (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra authored Nov 23, 2021
1 parent 01126b8 commit 08d6aaa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,13 @@ shakeRestart IdeState{..} reason acts =
(stopTime,()) <- duration (cancelShakeSession runner)
res <- shakeDatabaseProfile shakeDb
backlog <- readIORef $ dirtyKeys shakeExtras
queue <- atomically $ peekInProgress $ actionQueue shakeExtras
let profile = case res of
Just fp -> ", profile saved at " <> fp
_ -> ""
let msg = T.pack $ "Restarting build session " ++ reason' ++ keysMsg ++ abortMsg
let msg = T.pack $ "Restarting build session " ++ reason' ++ queueMsg ++ keysMsg ++ abortMsg
reason' = "due to " ++ reason
queueMsg = " with queue " ++ show (map actionName queue)
keysMsg = " for keys " ++ show (HSet.toList backlog) ++ " "
abortMsg = "(aborting the previous one took " ++ showDuration stopTime ++ profile ++ ")"
logDebug (logger shakeExtras) msg
Expand Down Expand Up @@ -700,7 +702,8 @@ newSession extras@ShakeExtras{..} shakeDb acts reason = do
-- The inferred type signature doesn't work in ghc >= 9.0.1
workRun :: (forall b. IO b -> IO b) -> IO (IO ())
workRun restore = withSpan "Shake session" $ \otSpan -> do
setTag otSpan "_reason" (fromString reason)
setTag otSpan "reason" (fromString reason)
setTag otSpan "queue" (fromString $ unlines $ map actionName reenqueued)
whenJust allPendingKeys $ \kk -> setTag otSpan "keys" (BS8.pack $ unlines $ map show $ toList kk)
let keysActs = pumpActionThread otSpan : map (run otSpan) (reenqueued ++ acts)
res <- try @SomeException $
Expand Down Expand Up @@ -893,7 +896,7 @@ useWithStaleFast' key file = do

-- Async trigger the key to be built anyway because we want to
-- keep updating the value in the key.
wait <- delayedAction $ mkDelayedAction ("C:" ++ show key) Debug $ use key file
wait <- delayedAction $ mkDelayedAction ("C:" ++ show key ++ ":" ++ fromNormalizedFilePath file) Debug $ use key file

s@ShakeExtras{state} <- askShake
r <- liftIO $ getValues state key file
Expand Down

0 comments on commit 08d6aaa

Please sign in to comment.