criterion 0.6.1.1 → 0.6.2.0
raw patch · 4 files changed
+34/−2 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Criterion.Config: cfgJUnitFile :: Config -> Last FilePath
- Criterion.Config: Config :: Last String -> Last Double -> Last Bool -> PrintExit -> Last Int -> Last FilePath -> Last Int -> Last FilePath -> Last FilePath -> Last FilePath -> Last Verbosity -> Config
+ Criterion.Config: Config :: Last String -> Last Double -> Last Bool -> PrintExit -> Last Int -> Last FilePath -> Last Int -> Last FilePath -> Last FilePath -> Last FilePath -> Last Verbosity -> Last FilePath -> Config
Files
- Criterion.hs +27/−1
- Criterion/Config.hs +4/−0
- Criterion/Main.hs +2/−0
- criterion.cabal +1/−1
Criterion.hs view
@@ -138,7 +138,9 @@ Just compareFile -> do liftIO $ writeFile compareFile $ resultForestToCSV rts - plotAll $ flatten rts+ let rs = flatten rts+ plotAll rs+ junit rs where go :: String -> Benchmark -> Criterion ResultForest go pfx (Benchmark desc b)@@ -201,3 +203,27 @@ meanR = mean r mean = estPoint . anMean . sampleAnalysis++-- | Write summary JUnit file (if applicable)+junit :: [Result] -> Criterion ()+junit rs+ = do junitOpt <- getConfigItem (getLast . cfgJUnitFile)+ case junitOpt of+ Just fn -> liftIO $ writeFile fn msg+ Nothing -> return ()+ where+ msg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +++ printf "<testsuite name=\"Criterion benchmarks\" tests=\"%d\">\n"+ (length rs) +++ concatMap single rs +++ "</testsuite>\n"+ single r = printf " <testcase name=\"%s\" time=\"%f\" />\n"+ (attrEsc $ description r) (estPoint $ anMean $ sampleAnalysis r)+ attrEsc = concatMap esc+ where+ esc '\'' = "'"+ esc '"' = """+ esc '<' = "<"+ esc '>' = ">"+ esc '&' = "&"+ esc c = [c]
Criterion/Config.hs view
@@ -56,6 +56,7 @@ , cfgCompareFile :: Last FilePath -- ^ Filename of the comparison CSV. , cfgTemplate :: Last FilePath -- ^ Filename of report template. , cfgVerbosity :: Last Verbosity -- ^ Whether to run verbosely.+ , cfgJUnitFile :: Last FilePath -- ^ Filename of JUnit report. } deriving (Eq, Read, Show, Typeable) instance Monoid Config where@@ -76,6 +77,7 @@ , cfgCompareFile = mempty , cfgTemplate = ljust "report.tpl" , cfgVerbosity = ljust Normal+ , cfgJUnitFile = mempty } -- | Constructor for 'Last' values.@@ -103,6 +105,7 @@ , cfgCompareFile = mempty , cfgTemplate = mempty , cfgVerbosity = mempty+ , cfgJUnitFile = mempty } appendConfig :: Config -> Config -> Config@@ -119,5 +122,6 @@ , cfgCompareFile = app cfgCompareFile a b , cfgTemplate = app cfgTemplate a b , cfgVerbosity = app cfgVerbosity a b+ , cfgJUnitFile = app cfgJUnitFile a b } where app f = mappend `on` f
Criterion/Main.hs view
@@ -118,6 +118,8 @@ "display version, then exit" , Option ['v'] ["verbose"] (noArg mempty { cfgVerbosity = ljust Verbose }) "print more output"+ , Option [] ["junit"] (ReqArg (\s -> return $ mempty { cfgJUnitFile = ljust s }) "FILENAME")+ "produce a JUnit report file of all results" ] printBanner :: Config -> IO ()
criterion.cabal view
@@ -1,5 +1,5 @@ name: criterion-version: 0.6.1.1+version: 0.6.2.0 synopsis: Robust, reliable performance measurement and analysis license: BSD3 license-file: LICENSE