Skip to content

Commit 08d6aaa

Browse files
authored
Add extra logging for GC (#2388)
1 parent 01126b8 commit 08d6aaa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ghcide/src/Development/IDE/Core/Shake.hs

+6-3
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,13 @@ shakeRestart IdeState{..} reason acts =
618618
(stopTime,()) <- duration (cancelShakeSession runner)
619619
res <- shakeDatabaseProfile shakeDb
620620
backlog <- readIORef $ dirtyKeys shakeExtras
621+
queue <- atomically $ peekInProgress $ actionQueue shakeExtras
621622
let profile = case res of
622623
Just fp -> ", profile saved at " <> fp
623624
_ -> ""
624-
let msg = T.pack $ "Restarting build session " ++ reason' ++ keysMsg ++ abortMsg
625+
let msg = T.pack $ "Restarting build session " ++ reason' ++ queueMsg ++ keysMsg ++ abortMsg
625626
reason' = "due to " ++ reason
627+
queueMsg = " with queue " ++ show (map actionName queue)
626628
keysMsg = " for keys " ++ show (HSet.toList backlog) ++ " "
627629
abortMsg = "(aborting the previous one took " ++ showDuration stopTime ++ profile ++ ")"
628630
logDebug (logger shakeExtras) msg
@@ -700,7 +702,8 @@ newSession extras@ShakeExtras{..} shakeDb acts reason = do
700702
-- The inferred type signature doesn't work in ghc >= 9.0.1
701703
workRun :: (forall b. IO b -> IO b) -> IO (IO ())
702704
workRun restore = withSpan "Shake session" $ \otSpan -> do
703-
setTag otSpan "_reason" (fromString reason)
705+
setTag otSpan "reason" (fromString reason)
706+
setTag otSpan "queue" (fromString $ unlines $ map actionName reenqueued)
704707
whenJust allPendingKeys $ \kk -> setTag otSpan "keys" (BS8.pack $ unlines $ map show $ toList kk)
705708
let keysActs = pumpActionThread otSpan : map (run otSpan) (reenqueued ++ acts)
706709
res <- try @SomeException $
@@ -893,7 +896,7 @@ useWithStaleFast' key file = do
893896

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

898901
s@ShakeExtras{state} <- askShake
899902
r <- liftIO $ getValues state key file

0 commit comments

Comments
 (0)