[Git][ghc/ghc][master] Add requestTickyCounterSamples to GHC.Internal.Profiling
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Oct 22 00:54:47 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
d328d173 by Luite Stegeman at 2024-10-21T12:39:18+00:00
Add requestTickyCounterSamples to GHC.Internal.Profiling
This allows the user to request ticky counters to be written to
the eventlog at specific times.
See #24645
- - - - -
4 changed files:
- libraries/ghc-internal/src/GHC/Internal/Profiling.hs
- rts/RtsSymbols.c
- rts/Ticky.c
- rts/include/rts/Ticky.h
Changes:
=====================================
libraries/ghc-internal/src/GHC/Internal/Profiling.hs
=====================================
@@ -9,6 +9,8 @@ module GHC.Internal.Profiling ( -- * Cost Centre Profiling
, startHeapProfTimer
, stopHeapProfTimer
, requestHeapCensus
+ -- * Ticky counters (eventlog)
+ , requestTickyCounterSamples
)where
import GHC.Internal.Base
@@ -51,3 +53,11 @@ foreign import ccall startHeapProfTimer :: IO ()
-- @since base-4.16.0.0
foreign import ccall stopHeapProfTimer :: IO ()
+-- | Request ticky counter samples to be written to the eventlog.
+--
+-- Note: This won't do anything unless you have specified RTS options on
+-- the command line to log ticky samples to the eventlog.
+--
+-- @since base-4.20.0.0
+
+foreign import ccall requestTickyCounterSamples :: IO ()
=====================================
rts/RtsSymbols.c
=====================================
@@ -922,6 +922,7 @@ extern char **environ;
SymI_HasProto(stopProfTimer) \
SymI_HasProto(startHeapProfTimer) \
SymI_HasProto(stopHeapProfTimer) \
+ SymI_HasProto(requestTickyCounterSamples) \
SymI_HasProto(setUserEra) \
SymI_HasProto(incrementUserEra) \
SymI_HasProto(getUserEra) \
=====================================
rts/Ticky.c
=====================================
@@ -418,3 +418,12 @@ void emitTickyCounterSamples(void)
}
#endif /* TICKY_TICKY */
+
+void requestTickyCounterSamples(void)
+{
+#if defined(TICKY_TICKY) && defined(TRACING)
+ if (RtsFlags.TraceFlags.ticky) {
+ emitTickyCounterSamples();
+ }
+#endif
+}
=====================================
rts/include/rts/Ticky.h
=====================================
@@ -32,3 +32,5 @@ typedef struct _StgEntCounter {
StgInt allocs; /* number of allocations by this fun */
struct _StgEntCounter *link;/* link to chain them all together */
} StgEntCounter;
+
+void requestTickyCounterSamples(void);
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d328d173fa54c35b78b1eef5edba797e1fa03fd4
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d328d173fa54c35b78b1eef5edba797e1fa03fd4
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241021/d79c87ba/attachment-0001.html>
More information about the ghc-commits
mailing list