-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Micro-benchmarking with detailed statistics.
--   
--   Benchmarks actions and produces statistics such as min, mean, median,
--   standard deviation, and max execution time. Also computes execution
--   time percentiles. Comes with functions to pretty-print the results.
@package benchpress
@version 0.2.2.10


-- | Benchmarks actions and produces statistics such as min, mean, median,
--   standard deviation, and max execution time. Also computes execution
--   time percentiles. Comes with functions to pretty-print the results.
--   
--   Here's an example showing a benchmark of copying a file:
--   
--   <pre>
--   import Control.Monad (when)
--   import qualified Data.ByteString as B
--   import System.IO
--   import Test.BenchPress
--   
--   inpath, outpath :: String
--   inpath = "/tmp/infile"
--   outpath = "/tmp/outfile"
--   
--   blockSize :: Int
--   blockSize = 4 * 1024
--   
--   copyUsingByteString :: Handle -&gt; Handle -&gt; IO ()
--   copyUsingByteString inf outf = go
--       where
--         go = do
--           bs &lt;- B.hGet inf blockSize
--           let numRead = B.length bs
--           when (numRead &gt; 0) $
--              B.hPut outf bs &gt;&gt; go
--   
--   main :: IO ()
--   main = bench 100 $ do
--            inf &lt;- openBinaryFile inpath ReadMode
--            outf &lt;- openBinaryFile outpath WriteMode
--            copyUsingByteString inf outf
--            hClose outf
--            hClose inf
--   </pre>
module Test.BenchPress

-- | <tt>benchmark iters setup teardown action</tt> runs <tt>action</tt>
--   <tt>iters</tt> times measuring the execution time of each run.
--   <tt>setup</tt> and <tt>teardown</tt> are run before and after each run
--   respectively. <tt>teardown</tt> is run even if <tt>action</tt> raises
--   an exception. Returns statistics for both the measured CPU times and
--   wall clock times, in that order.
benchmark :: Int -> IO a -> (a -> IO b) -> (a -> IO c) -> IO (Stats, Stats)

-- | Convenience function that runs a benchmark using <a>benchmark</a> and
--   prints timing statistics using <a>printDetailedStats</a>. The
--   statistics are computed from the measured CPU times. Writes output to
--   standard output.
bench :: Int -> IO a -> IO ()

-- | Convenience function that runs several benchmarks using
--   <a>benchmark</a> and prints a timing statistics summary using
--   <a>printStatsSummaries</a>. The statistics are computed from the
--   measured CPU times. Each benchmark has an associated label that is
--   used to identify the benchmark in the printed results. Writes output
--   to standard output.
benchMany :: Int -> [(String, IO a)] -> IO ()

-- | Execution time statistics for a benchmark. All measured times are
--   given in milliseconds.
data Stats
Stats :: Double -> Double -> Double -> Double -> Double -> [(Int, Double)] -> Stats

-- | Shortest execution time.
[min] :: Stats -> Double

-- | Mean execution time.
[mean] :: Stats -> Double

-- | Execution time standard deviation.
[stddev] :: Stats -> Double

-- | Median execution time.
[median] :: Stats -> Double

-- | Longest execution time.
[max] :: Stats -> Double

-- | Execution time divided into percentiles. The first component of the
--   pair is the percentile given as an integer between 0 and 100,
--   inclusive. The second component is the execution time of the slowest
--   iteration within the percentile.
[percentiles] :: Stats -> [(Int, Double)]

-- | Prints detailed statistics. Printed statistics include min, mean,
--   standard deviation, median, and max execution time. Also prints
--   execution time percentiles. Writes output to standard output.
printDetailedStats :: Stats -> IO ()

-- | Prints a summary row for each benchmark with an associated label. The
--   summary contains the same statistics as in <a>printDetailedStats</a>
--   except for the execution time percentiles. Writes output to standard
--   output.
printStatsSummaries :: [(String, Stats)] -> IO ()
instance GHC.Show.Show Test.BenchPress.Stats
