@@ -125,6 +125,7 @@ import Data.IORef
125 (IORef, modifyIORef, newIORef, readIORef, writeIORef, atomicModifyIORef)
125 (IORef, modifyIORef, newIORef, readIORef, writeIORef, atomicModifyIORef)
126import Data.List ((\\))
126import Data.List ((\\))
127import Data.Maybe (fromJust)
127import Data.Maybe (fromJust)
128+import Data.Semigroup ((<>))
128import Data.Set (Set)
129import Data.Set (Set)
129import GHC.Conc (ThreadId(..))
130import GHC.Conc (ThreadId(..))
130import GHC.Exts
131import GHC.Exts
@@ -621,34 +622,34 @@ dumpSVarStats sv ss style = do
621 else return (0, 0, 0)
622 else return (0, 0, 0)
623 return $ unlines
624 return $ unlines
624− [ "total dispatches = " ++ show dispatches
625+ [ "total dispatches = " <> show dispatches
625− , "max workers = " ++ show maxWrk
626+ , "max workers = " <> show maxWrk
626− , "max outQSize = " ++ show maxOq
627+ , "max outQSize = " <> show maxOq
627− ++ (if style == AheadVar
628+ <> (if style == AheadVar
628− then "\nheap max size = " ++ show maxHp
629+ then "\nheap max size = " <> show maxHp
630− ++ (if minLat > 0
631+ <> (if minLat > 0
631 then "\nmin worker latency = "
632 then "\nmin worker latency = "
632− ++ secs (fromIntegral minLat * 1e-9)
633+ <> secs (fromIntegral minLat * 1e-9)
634− ++ (if maxLat > 0
635+ <> (if maxLat > 0
635 then "\nmax worker latency = "
636 then "\nmax worker latency = "
636− ++ secs (fromIntegral maxLat * 1e-9)
637+ <> secs (fromIntegral maxLat * 1e-9)
638− ++ (if avgCnt > 0
639+ <> (if avgCnt > 0
639 then let lat = avgTime `div` fromIntegral avgCnt
640 then let lat = avgTime `div` fromIntegral avgCnt
640 in "\navg worker latency = "
641 in "\navg worker latency = "
641− ++ secs (fromIntegral lat * 1e-9)
642+ <> secs (fromIntegral lat * 1e-9)
643− ++ (if svarLat > 0
644+ <> (if svarLat > 0
644 then "\nSVar latency = "
645 then "\nSVar latency = "
645− ++ secs (fromIntegral svarLat * 1e-9)
646+ <> secs (fromIntegral svarLat * 1e-9)
647− ++ (if svarCnt > 0
648+ <> (if svarCnt > 0
648− then "\nSVar yield count = " ++ show svarCnt
649+ then "\nSVar yield count = " <> show svarCnt
650− ++ (if svarGainLossCnt > 0
651+ <> (if svarGainLossCnt > 0
651− then "\nSVar gain/loss yield count = " ++ show svarGainLossCnt
652+ then "\nSVar gain/loss yield count = " <> show svarGainLossCnt
@@ -663,10 +664,10 @@ dumpSVar sv = do
663 (oheap, oheapSeq) <- readIORef $ outputHeap sv
664 (oheap, oheapSeq) <- readIORef $ outputHeap sv
664 (wq, wqSeq) <- readIORef $ aheadWorkQueue sv
665 (wq, wqSeq) <- readIORef $ aheadWorkQueue sv
665 return $ unlines
666 return $ unlines
666− [ "heap length = " ++ show (H.size oheap)
667+ [ "heap length = " <> show (H.size oheap)
667− , "heap seqeunce = " ++ show oheapSeq
668+ , "heap seqeunce = " <> show oheapSeq
668− , "work queue length = " ++ show (length wq)
669+ , "work queue length = " <> show (length wq)
669− , "work queue sequence = " ++ show wqSeq
670+ , "work queue sequence = " <> show wqSeq
671 else return []
672 else return []
@@ -681,23 +682,23 @@ dumpSVar sv = do
682 return $ unlines
683 return $ unlines
684− "Creator tid = " ++ show (svarCreator sv),
685+ "Creator tid = " <> show (svarCreator sv),
685− "style = " ++ show (svarStyle sv)
686+ "style = " <> show (svarStyle sv)
686 , "---------CURRENT STATE-----------"
687 , "---------CURRENT STATE-----------"
687− , "outputQueue length computed = " ++ show (length oqList)
688+ , "outputQueue length computed = " <> show (length oqList)
688− , "outputQueue length maintained = " ++ show oqLen
689+ , "outputQueue length maintained = " <> show oqLen
689 -- XXX print the types of events in the outputQueue, first 5
690 -- XXX print the types of events in the outputQueue, first 5
690− , "outputDoorBell = " ++ show db
691+ , "outputDoorBell = " <> show db
692− ++ aheadDump
693+ <> aheadDump
693− ++ unlines
694+ <> unlines
694− [ "needDoorBell = " ++ show waiting
695+ [ "needDoorBell = " <> show waiting
695− , "running threads = " ++ show rthread
696+ , "running threads = " <> show rthread
696 -- XXX print the status of first 5 threads
697 -- XXX print the status of first 5 threads
697− , "running thread count = " ++ show workers
698+ , "running thread count = " <> show workers
699− ++ "---------STATS-----------\n"
700+ <> "---------STATS-----------\n"
700− ++ stats
701+ <> stats
702-- MVar diagnostics has some overhead - around 5% on asyncly null benchmark, we
703-- MVar diagnostics has some overhead - around 5% on asyncly null benchmark, we
703-- can keep it on in production to debug problems quickly if and when they
704-- can keep it on in production to debug problems quickly if and when they
@@ -708,14 +709,14 @@ dumpSVar sv = do
708mvarExcHandler :: SVar t m a -> String -> BlockedIndefinitelyOnMVar -> IO ()
709mvarExcHandler :: SVar t m a -> String -> BlockedIndefinitelyOnMVar -> IO ()
709mvarExcHandler sv label e@BlockedIndefinitelyOnMVar = do
710mvarExcHandler sv label e@BlockedIndefinitelyOnMVar = do
710 svInfo <- dumpSVar sv
711 svInfo <- dumpSVar sv
711− hPutStrLn stderr $ label ++ " " ++ "BlockedIndefinitelyOnMVar\n" ++ svInfo
712+ hPutStrLn stderr $ label <> " " <> "BlockedIndefinitelyOnMVar\n" <> svInfo
712 throwIO e
713 throwIO e
714{-# NOINLINE stmExcHandler #-}
715{-# NOINLINE stmExcHandler #-}
715stmExcHandler :: SVar t m a -> String -> BlockedIndefinitelyOnSTM -> IO ()
716stmExcHandler :: SVar t m a -> String -> BlockedIndefinitelyOnSTM -> IO ()
716stmExcHandler sv label e@BlockedIndefinitelyOnSTM = do
717stmExcHandler sv label e@BlockedIndefinitelyOnSTM = do
717 svInfo <- dumpSVar sv
718 svInfo <- dumpSVar sv
718− hPutStrLn stderr $ label ++ " " ++ "BlockedIndefinitelyOnSTM\n" ++ svInfo
719+ hPutStrLn stderr $ label <> " " <> "BlockedIndefinitelyOnSTM\n" <> svInfo
719 throwIO e
720 throwIO e
721withDiagMVar :: SVar t m a -> String -> IO () -> IO ()
722withDiagMVar :: SVar t m a -> String -> IO () -> IO ()