Skip to content

Commit e9680ec

Browse files
committed
Atomically stats in hls-graph
1 parent 9533def commit e9680ec

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

hls-graph/src/Development/IDE/Graph/Database.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Development.IDE.Graph.Database(
1212
shakeGetDirtySet,
1313
shakeGetCleanKeys
1414
,shakeGetBuildEdges) where
15-
import Control.Concurrent.STM (atomically,
15+
import Control.Concurrent.STM.Stats (atomicallyNamed,
1616
readTVarIO)
1717
import Data.Dynamic
1818
import Data.Maybe
@@ -64,7 +64,7 @@ shakeRunDatabaseForKeys
6464
-> [Action a]
6565
-> IO ([a], [IO ()])
6666
shakeRunDatabaseForKeys keysChanged (ShakeDatabase lenAs1 as1 db) as2 = do
67-
atomically $ incDatabase db keysChanged
67+
atomicallyNamed "incDatabase" $ incDatabase db keysChanged
6868
as <- fmap (drop lenAs1) $ runActions db $ map unvoid as1 ++ as2
6969
return (as, [])
7070

hls-graph/src/Development/IDE/Graph/Internal/Database.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module Development.IDE.Graph.Internal.Database (newDatabase, incDatabase, build,
1616

1717
import Control.Concurrent.Async
1818
import Control.Concurrent.Extra
19-
import Control.Concurrent.STM (STM, atomically,
19+
import Control.Concurrent.STM.Stats (STM, atomically,
20+
atomicallyNamed,
2021
modifyTVar', newTVarIO,
2122
readTVarIO)
2223
import Control.Exception
@@ -93,7 +94,7 @@ builder db@Database{..} keys = withRunInIO $ \(RunInIO run) -> do
9394
-- Things that I need to force before my results are ready
9495
toForce <- liftIO $ newTVarIO []
9596
current <- liftIO $ readTVarIO databaseStep
96-
results <- liftIO $ atomically $ for keys $ \id -> do
97+
results <- liftIO $ atomicallyNamed "builder" $ for keys $ \id -> do
9798
-- Spawn the id if needed
9899
status <- SMap.lookup id databaseValues
99100
val <- case viewDirty current $ maybe (Dirty Nothing) keyStatus status of
@@ -165,7 +166,7 @@ compute db@Database{..} key mode result = do
165166
(getResultDepsDefault [] previousDeps)
166167
(HSet.fromList deps)
167168
_ -> pure ()
168-
atomically $ SMap.focus (updateStatus $ Clean res) key databaseValues
169+
atomicallyNamed "compute" $ SMap.focus (updateStatus $ Clean res) key databaseValues
169170
pure res
170171

171172
updateStatus :: Monad m => Status -> Focus.Focus KeyDetails m ()
@@ -214,7 +215,7 @@ updateReverseDeps
214215
-> [Key] -- ^ Previous direct dependencies of Id
215216
-> HashSet Key -- ^ Current direct dependencies of Id
216217
-> IO ()
217-
updateReverseDeps myId db prev new = uninterruptibleMask_ $ atomically $ do
218+
updateReverseDeps myId db prev new = uninterruptibleMask_ $ atomicallyNamed "updateReverseDeps" $ do
218219
forM_ prev $ \d ->
219220
unless (d `HSet.member` new) $
220221
doOne (HSet.delete myId) d

hls-graph/src/Development/IDE/Graph/Internal/Profile.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
module Development.IDE.Graph.Internal.Profile (writeProfile) where
99

10-
import Control.Concurrent.STM (readTVarIO)
10+
import Control.Concurrent.STM.Stats (readTVarIO)
1111
import Data.Bifunctor
1212
import qualified Data.ByteString.Lazy.Char8 as LBS
1313
import Data.Char

hls-graph/src/Development/IDE/Graph/Internal/Types.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Development.IDE.Graph.Internal.Types where
1414
import Control.Applicative
1515
import Control.Monad.Catch
1616
-- Needed in GHC 8.6.5
17-
import Control.Concurrent.STM (TVar, atomically)
17+
import Control.Concurrent.STM.Stats (TVar, atomically)
1818
import Control.Monad.Fail
1919
import Control.Monad.IO.Class
2020
import Control.Monad.Trans.Reader

0 commit comments

Comments
 (0)