| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Mikan.Utils.Trace
Description
Utilities for tracing to the eventlog.
These functions should be preferred over Debug.Trace.
Synopsis
- traceEventIO :: MonadIO m => Text -> m ()
- traceMarkerIO :: MonadIO m => Text -> m ()
- getUserEra :: MonadIO m => m Word
- setUserEra :: MonadIO m => Word -> m ()
- incrementUserEra :: MonadIO m => Word -> m Word
- incrementUserEra_ :: MonadIO m => Word -> m ()
Eventlog tracing
Eventlog tracing is a performance profiling system. These functions emit extra events into the eventlog. In combination with eventlog profiling tools these functions can be used for monitoring execution and investigating performance problems.
The easiest way to enable the eventlog is to pass +RTS -l-au -RTS to mikan.
The GHC Manual
provides documentation on further options.
traceEventIO :: MonadIO m => Text -> m () Source #
Execution phase markers
When looking at a profile for the execution of a program we often want to be able to mark certain points or phases in the execution and see that visually in the profile.
For example, a program might have several distinct phases with different performance or resource behaviour in each phase. To properly interpret the profile graph we really want to see when each phase starts and ends.
Markers let us do this: we can annotate the program to emit a marker at an appropriate point during execution and then see that in a profile.
traceMarkerIO :: MonadIO m => Text -> m () Source #
Era profiling
Era profiling lets us mark each closure with an era that tracks when
the closure was allocated. It can be enabled by passing +RTS -he -RTS to
a profiled build of mikan.
There are two ways to control the current era:
- Automatically via
+RTS --automatic-era-increment -RTS, which increments the era on every major GC. - Manually via
setUserEra,incrementUserEra_, andincrementUserEra.
getUserEra :: MonadIO m => m Word Source #
Get the user era count if heap profiling is enabled.
If heap profiling is disabled, this function will always return 0.
setUserEra :: MonadIO m => Word -> m () Source #
Set the user era count if heap profiling is enabled.
If heap profiling is disabled, this function is a no-op.
incrementUserEra :: MonadIO m => Word -> m Word Source #
Increment the user era count if heap profiling is enabled, and return the new era.
If heap profiling is disabled, this function will always return 0.
incrementUserEra_ :: MonadIO m => Word -> m () Source #
Increment the user era count if heap profiling is enabled.
If heap profiling is disabled, this function will always return 0.