summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2022-04-21 12:37:29 +0200
committerTom Smeding <tom@tomsmeding.com>2022-04-21 12:37:29 +0200
commit3654951ca31b225c84c1b1fa8eafe34b701c91e6 (patch)
tree0c625b42765b6db18141222310f289ec3f78f5cc
parent0d28235bd2da566b57e9fcf4de8abfb3b1c2f237 (diff)
Get entire log instead of only a prefix
-rw-r--r--src/GHC/GC_Hook.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/GHC/GC_Hook.hs b/src/GHC/GC_Hook.hs
index 44826c9..35fbbc5 100644
--- a/src/GHC/GC_Hook.hs
+++ b/src/GHC/GC_Hook.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TypeApplications #-}
module GHC.GC_Hook (
setGCHook,
@@ -97,6 +98,12 @@ setGCHook = do
-- will never get the same structure twice.
getGCLog :: IO [Details]
getGCLog =
+ getLogBatch >>= \case
+ [] -> return []
+ batch -> (batch ++) <$> getGCLog
+
+getLogBatch :: IO [Details]
+getLogBatch =
let bufferCapacity = 2048
in allocaBytes bufferCapacity $ \pbuffer ->
alloca $ \punitsize ->