Copyright | (c) Ben Weitzman 2018 |
---|---|
License | MIT |
Maintainer | ben@costarastrolgoy.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- profileEffect :: forall q r v. (Member (Writer EffectStats) r, Member IO r, Member q r, Named q) => Eff r v -> Eff r v
- class Named f
- data SingleEffectStats = SingleEffectStats {}
- newtype EffectStats = EffectStats (Map String (Map String SingleEffectStats))
- forEachStat :: Monad m => EffectStats -> (String -> String -> SingleEffectStats -> m ()) -> m ()
- drawEffectStats :: EffectStats -> String
Documentation
profileEffect :: forall q r v. (Member (Writer EffectStats) r, Member IO r, Member q r, Named q) => Eff r v -> Eff r v Source #
Automatically time and count each individual effectful compoutation. An effect that is interpreted to another effect will count towards both effects, flame graph style.
Named
is a typeclass that defines the type names and constructor names for effects.
Effects are defined as GADTs, and unfortunately, GADTs don't work well with Generics
or Data
, so this is a small typeclass that can be implemented manually to provide
the info the profiler needs.
getDataTypeName, getConstructorName
data SingleEffectStats Source #
The stats relating to a single effect. Includes the number of times run and the total amount of time spent running.
Instances
Show SingleEffectStats Source # | |
Defined in Control.Monad.Freer.Profiling showsPrec :: Int -> SingleEffectStats -> ShowS # show :: SingleEffectStats -> String # showList :: [SingleEffectStats] -> ShowS # | |
Semigroup SingleEffectStats Source # | |
Defined in Control.Monad.Freer.Profiling (<>) :: SingleEffectStats -> SingleEffectStats -> SingleEffectStats # sconcat :: NonEmpty SingleEffectStats -> SingleEffectStats # stimes :: Integral b => b -> SingleEffectStats -> SingleEffectStats # | |
Monoid SingleEffectStats Source # | |
Defined in Control.Monad.Freer.Profiling |
newtype EffectStats Source #
The stats for a whole bunch of effects
Instances
Show EffectStats Source # | |
Defined in Control.Monad.Freer.Profiling showsPrec :: Int -> EffectStats -> ShowS # show :: EffectStats -> String # showList :: [EffectStats] -> ShowS # | |
Semigroup EffectStats Source # | |
Defined in Control.Monad.Freer.Profiling (<>) :: EffectStats -> EffectStats -> EffectStats # sconcat :: NonEmpty EffectStats -> EffectStats # stimes :: Integral b => b -> EffectStats -> EffectStats # | |
Monoid EffectStats Source # | |
Defined in Control.Monad.Freer.Profiling mempty :: EffectStats # mappend :: EffectStats -> EffectStats -> EffectStats # mconcat :: [EffectStats] -> EffectStats # |
forEachStat :: Monad m => EffectStats -> (String -> String -> SingleEffectStats -> m ()) -> m () Source #
Iterate through each indivudal stat
drawEffectStats :: EffectStats -> String Source #
Pretty print the effect stats