diff --git a/libraries/ghc-internal/src/GHC/Internal/Profiling.hs b/libraries/ghc-internal/src/GHC/Internal/Profiling.hs index 16f6851553282977276a73a7f022b43c8a8c4f8a..766a44b968edd27d1c58c28fb95f0bf15c3f86bd 100644 --- a/libraries/ghc-internal/src/GHC/Internal/Profiling.hs +++ b/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 () diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index d4ce9acb9432ece755b1ce6d1966299a54c7d525..a447f126bd09be61a8dc02337b077ab7d3a287e4 100644 --- a/rts/RtsSymbols.c +++ b/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) \ diff --git a/rts/Ticky.c b/rts/Ticky.c index 65d52c6708137b9d6f12265e2c17ac6f57596adc..111bb19607fb7240184645dcde556d6904d2f2cc 100644 --- a/rts/Ticky.c +++ b/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 +} diff --git a/rts/include/rts/Ticky.h b/rts/include/rts/Ticky.h index 4d58c8e63afd885964d74f5b65f14554695883a6..4b04d474dcd8a736b46d1c5dd89a82d9a645c208 100644 --- a/rts/include/rts/Ticky.h +++ b/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);