Criterion.IO

criterion-1.6.4.0: Robust, reliable performance measurement and analysis

Copyright | (c) 2009-2014 Bryan O'Sullivan
License | BSD-style
Maintainer | bos@serpentine.com
Stability | experimental
Portability | GHC
Safe Haskell | Trustworthy
Language | Haskell2010

Criterion.IO

Description

Input and output actions.

Synopsis

- header :: ByteString
- headerRoot :: String
- critVersion :: String
- hGetRecords :: Binary a => Handle -> IO (Either String [a])
- hPutRecords :: Binary a => Handle -> [a] -> IO ()
- readRecords :: Binary a => FilePath -> IO (Either String [a])
- writeRecords :: Binary a => FilePath -> [a] -> IO ()
- type ReportFileContents = (String, String, [Report])
- readJSONReports :: FilePath -> IO (Either String ReportFileContents)
- writeJSONReports :: FilePath -> [Report] -> IO ()

# Documentation

header :: ByteString #

The header identifies a criterion data file. This contains version information; there is no expectation of cross-version compatibility.

headerRoot :: String #

The magic string we expect to start off the header.

critVersion :: String #

The current version of criterion, encoded into a string that is used in files.

hGetRecords :: Binary a => Handle -> IO (Either String [a]) #

Read all records from the given `Handle`.

hPutRecords :: Binary a => Handle -> [a] -> IO () #

Write records to the given `Handle`.

readRecords :: Binary a => FilePath -> IO (Either String [a]) #

Read all records from the given file.

writeRecords :: Binary a => FilePath -> [a] -> IO () #

Write records to the given file.

type ReportFileContents = (String, String, [Report]) #

On disk we store (name,version,reports), where `version` is the version of Criterion used to generate the file.

readJSONReports :: FilePath -> IO (Either String ReportFileContents) #

Alternative file IO with JSON instances. Read a list of reports from a .json file produced by criterion.

If the version does not match exactly, this issues a warning.

writeJSONReports :: FilePath -> [Report] -> IO () #

Write a list of reports to a JSON file. Includes a header, which includes the current Criterion version number. This should be the inverse of `readJSONReports`.