1. Bryan O'Sullivan
  2. criterion

Commits

Neil Brown  committed 90b1e8b

Added a command-line option to allow plotting the KDEs for all the benchmarks with the same X axis

  • Participants
  • Parent commits 96f2b43
  • Branches default

Comments (0)

Files changed (2)

File Criterion/Config.hs

View file
     , cfgConfInterval :: Last Double -- ^ Confidence interval to use.
     , cfgPerformGC    :: Last Bool   -- ^ Whether to run the GC between passes.
     , cfgPlot         :: MultiMap Plot PlotOutput -- ^ What to plot, and where.
+    , cfgPlotSameAxis :: Last Bool
     , cfgPrintExit    :: PrintExit   -- ^ Whether to print information and exit.
     , cfgResamples    :: Last Int    -- ^ Number of resamples to perform.
     , cfgSamples      :: Last Int    -- ^ Number of samples to collect.
                 , cfgConfInterval = ljust 0.95
                 , cfgPerformGC    = ljust False
                 , cfgPlot         = mempty
+                , cfgPlotSameAxis = ljust False
                 , cfgPrintExit    = Nada
                 , cfgResamples    = ljust (100 * 1000)
                 , cfgSamples      = ljust 100
               , cfgConfInterval = mempty
               , cfgPerformGC    = mempty
               , cfgPlot         = mempty
+              , cfgPlotSameAxis = mempty
               , cfgPrintExit    = mempty
               , cfgResamples    = mempty
               , cfgSamples      = mempty
     , cfgConfInterval = app cfgConfInterval a b
     , cfgPerformGC    = app cfgPerformGC a b
     , cfgPlot         = app cfgPlot a b
+    , cfgPlotSameAxis = app cfgPlotSameAxis a b
     , cfgPrintExit    = app cfgPrintExit a b
     , cfgSamples      = app cfgSamples a b
     , cfgResamples    = app cfgResamples a b

File Criterion/Main.hs

View file
 import Criterion.Environment (measureEnvironment)
 import Criterion.IO (note, printError)
 import Criterion.MultiMap (singleton)
-import Criterion.Types (Benchmarkable(..), Benchmark, bench, benchNames, bgroup)
+import Criterion.Types (Benchmarkable(..), Benchmark(..), bench, benchNames, bgroup)
 import Data.List (isPrefixOf, sort)
 import Data.Monoid (Monoid(..), Last(..))
 import System.Console.GetOpt
           "print a list of all benchmark names, then exit"
  , Option ['k'] ["plot-kde"] (ReqArg (plot KernelDensity) "TYPE")
           "plot kernel density estimate of probabilities"
+ , Option [] ["kde-same-axis"] (noArg mempty {cfgPlotSameAxis = ljust True })
+          "plot all KDE graphs with the same X axis range (useful for comparison)"
  , Option ['q'] ["quiet"] (noArg mempty { cfgVerbosity = ljust Quiet })
           "print less output"
  , Option [] ["resamples"]
     else do
       env <- measureEnvironment cfg
       let shouldRun b = null args || any (`isPrefixOf` b) args
-      mapM_ (runAndAnalyse shouldRun cfg env) bs
+      runAndAnalyse shouldRun cfg env $ BenchGroup "" bs
 
 -- | Display an error message from a command line parsing failure, and
 -- exit.