-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | low-level performance statistics -- -- See perf for example results and write-up. @package perf @version 0.1.2 module Perf.Cycles -- | Cycles type Cycles = Word64 -- | `tick f a` applies a to f, and strictly returns a (number of cycles, -- application result) tuple tick :: (a -> b) -> a -> IO (Cycles, b) -- | variation that just acts on an a tick' :: a -> IO (Cycles, a) -- | variation that takes an `IO a` tickM :: IO a -> IO (Cycles, a) -- | variation that just measures the number of cycles to take a tick -- measurement tick_ :: IO Cycles -- | `tickf f a` applies a to f, and strictly returns a (number of cycles, -- application result) tuple, measuring just the f effect tickf :: (a -> b) -> a -> IO (Cycles, b) -- | monadic version tickfM :: (a -> IO b) -> a -> IO (Cycles, b) -- | `ticka f a` applies a to f, and strictly returns a (number of cycles, -- application result) tuple, measuring just the a effect ticka :: (a -> b) -> a -> IO (Cycles, b) -- | `tickfa f a` applies a to f, and strictly returns a (number of cycles, -- application result) tuple, measuring both the f and the a effects -- separately. tickfa :: (a -> b) -> a -> IO ((Cycles, Cycles), b) -- | n measurements of whatever tick engine spin :: Int -> ((a -> b) -> a -> IO (c, b)) -> (a -> b) -> a -> IO ([c], b) spins :: Int -> ((a -> b) -> a -> IO (c, b)) -> (a -> b) -> [a] -> IO ([[c]], [b]) -- | n measurements of whatever tick engine spinM :: Int -> ((a -> IO b) -> a -> IO (c, b)) -> (a -> IO b) -> a -> IO ([c], b) -- | warm up the register, and the setup warmup :: Int -> IO Double -- | helpers force :: (NFData a) => a -> a replicateM' :: Monad m => Int -> m a -> m [a] instance Data.Semigroup.Semigroup Perf.Cycles.Cycles instance GHC.Base.Monoid Perf.Cycles.Cycles module Perf.Measure data Measure m b Measure :: b -> m a -> (a -> m b) -> Measure m b [measure] :: Measure m b -> b [prestep] :: Measure m b -> m a [poststep] :: Measure m b -> a -> m b runMeasure :: (MonadIO m) => Measure m b -> m a -> m (b, a) runMeasureN :: (MonadIO m) => Int -> Measure m b -> m a -> m (b, a) cost :: (MonadIO m) => Measure m b -> m b cputime :: Measure IO Integer realtime :: Measure IO NominalDiffTime count :: Measure IO Int cycles :: Measure IO Cycles instance GHC.Base.Monoid GHC.Integer.Type.Integer instance GHC.Base.Monoid Data.Time.Clock.UTC.NominalDiffTime instance GHC.Base.Monoid GHC.Types.Int module Perf data PerfT m b a type Perf b a = PerfT Identity b a perf :: (MonadIO m, Monoid b, Semigroup b) => Text -> Measure m b -> m a -> PerfT m b a perfN :: (MonadIO m, Semigroup b, Monoid b) => Int -> Text -> Measure m b -> m a -> PerfT m b a runPerfT :: PerfT m b a -> m (a, Map Text b) evalPerfT :: (Monad m) => PerfT m b a -> m a execPerfT :: (Monad m) => PerfT m b a -> m (Map Text b) instance GHC.Base.Monad m => GHC.Base.Monad (Perf.PerfT m b) instance GHC.Base.Monad m => GHC.Base.Applicative (Perf.PerfT m b) instance GHC.Base.Functor m => GHC.Base.Functor (Perf.PerfT m b) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Perf.PerfT m b)