summaryrefslogtreecommitdiff
path: root/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc')
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc16
1 files changed, 12 insertions, 4 deletions
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc b/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc
index 363d73d79a..964b1f0b45 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc
+++ b/libraries/ghc-heap/GHC/Exts/Heap/ProfInfo/PeekProfInfo_ProfilingEnabled.hsc
@@ -3,6 +3,7 @@
module GHC.Exts.Heap.ProfInfo.PeekProfInfo_ProfilingEnabled(
peekStgTSOProfInfo
+ , peekTopCCS
) where
#if __GLASGOW_HASKELL__ >= 811
@@ -33,16 +34,20 @@ import Prelude
type AddressSet = IntSet
type AddressMap = IntMap
-peekStgTSOProfInfo :: Ptr a -> IO (Maybe StgTSOProfInfo)
-peekStgTSOProfInfo tsoPtr = do
+peekStgTSOProfInfo :: (Ptr b -> IO (Maybe CostCentreStack)) -> Ptr a -> IO (Maybe StgTSOProfInfo)
+peekStgTSOProfInfo decodeCCS tsoPtr = do
cccs_ptr <- peekByteOff tsoPtr cccsOffset
- costCenterCacheRef <- newIORef IntMap.empty
- cccs' <- peekCostCentreStack IntSet.empty costCenterCacheRef cccs_ptr
+ cccs' <- decodeCCS cccs_ptr
return $ Just StgTSOProfInfo {
cccs = cccs'
}
+peekTopCCS :: Ptr b -> IO (Maybe CostCentreStack)
+peekTopCCS cccs_ptr = do
+ costCenterCacheRef <- newIORef IntMap.empty
+ peekCostCentreStack IntSet.empty costCenterCacheRef cccs_ptr
+
cccsOffset :: Int
cccsOffset = (#const OFFSET_StgTSO_cccs) + (#size StgHeader)
@@ -162,4 +167,7 @@ import GHC.Exts.Heap.ProfInfo.Types
peekStgTSOProfInfo :: Ptr a -> IO (Maybe StgTSOProfInfo)
peekStgTSOProfInfo _ = return Nothing
+
+peekTopCCS :: Ptr a -> IO (Maybe CostCentreStack)
+peekTopCCS _ = return Nothing
#endif