criterion-0.6.0.1: Robust, reliable performance measurement and analysis

Portability | GHC
Stability | experimental
Maintainer | bos@serpentine.com

Criterion.Report

Contents

- Rendering helper functions

Description

Reporting functions.

Synopsis

- data Report = Report {
  - reportNumber :: Int
  - reportName :: String
  - reportTimes :: Sample
  - reportAnalysis :: SampleAnalysis
  - reportOutliers :: Outliers
  }
- formatReport :: [Report] -> ByteString -> IO ByteString
- report :: [Report] -> Criterion ()
- data TemplateException = TemplateNotFound FilePath
- loadTemplate :: [FilePath] -> FilePath -> IO ByteString
- includeFile :: MonadIO m => [FilePath] -> ByteString -> m ByteString
- templateDir :: FilePath
- vector :: (Monad m, Vector v a, MuVar a) => String -> v a -> MuType m
- vector2 :: (Monad m, Vector v a, Vector v b, MuVar a, MuVar b) => String -> String -> v a -> v b -> MuType m

# Documentation

data Report

Constructors

Report |

Fields

reportNumber :: Int
reportName :: String
reportTimes :: Sample
reportAnalysis :: SampleAnalysis
reportOutliers :: Outliers

Instances

Eq Report |
Data Report |
Show Report |
Typeable Report |

formatReport

Arguments

:: [Report] |
-> ByteString | Hastache template.
-> IO ByteString |

Format a series of `Report` values using the given Hastache template.

report :: [Report] -> Criterion ()

Write out a series of `Report` values to a single file, if configured to do so.

# Rendering helper functions

data TemplateException

A problem arose with a template.

Constructors

TemplateNotFound FilePath | The template could not be found.

Instances

Eq TemplateException |
Data TemplateException |
Show TemplateException |
Typeable TemplateException |
Exception TemplateException |

loadTemplate

Arguments

:: [FilePath] | Search path.
-> FilePath | Name of template file.
-> IO ByteString |

Load a Hastache template file.

If the name is an absolute or relative path, the search path is not used, and the name is treated as a literal path.

This function throws a `TemplateException` if the template could not be found, or an `IOException` if no template could be loaded.

includeFile

Arguments

:: MonadIO m |
=> [FilePath] | Directories to search.
-> ByteString | Name of the file to search for.
-> m ByteString |

Attempt to include the contents of a file based on a search path. Returns `empty` if the search fails or the file could not be read.

Intended for use with Hastache's `MuLambdaM`, for example:

    context "include" = MuLambdaM $ includeFile [templateDir]

Hastache template expansion is not performed within the included file. No attempt is made to ensure that the included file path is safe, i.e. that it does not refer to an unexpected file such as "`etcpasswd`".

templateDir :: FilePath

The path to the template and other files used for generating reports.

vector

Arguments

:: (Monad m, Vector v a, MuVar a) |
=> String | Name to use when substituting.
-> v a |
-> MuType m |

Render the elements of a vector.

For example, given this piece of Haskell:

    mkStrContext $ \name ->
     case name of
       "foo" -> vector "x" foo

It will substitute each value in the vector for `x` in the following Hastache template:

     {{#foo}}
      {{x}}
     {{/foo}}

vector2

Arguments

:: (Monad m, Vector v a, Vector v b, MuVar a, MuVar b) |
=> String | Name for elements from the first vector.
-> String | Name for elements from the second vector.
-> v a | First vector.
-> v b | Second vector.
-> MuType m |

Render the elements of two vectors.