Commits

Bryan O'Sullivan committed 46591be

Add a description to outlier variance, for rendering purposes.

Comments (0)

Files changed (2)

Criterion/Analysis.hs

-{-# LANGUAGE DeriveDataTypeable, RecordWildCards #-}
+{-# LANGUAGE DeriveDataTypeable, RecordWildCards, UnboxedTuples #-}
 -- |
 -- Module      : Criterion.Analysis
 -- Copyright   : (c) 2009, 2010, 2011 Bryan O'Sullivan
                                --   standard deviation.
                 -> Double      -- ^ Number of original iterations.
                 -> OutlierVariance
-outlierVariance µ σ a = OutlierVariance effect varOutMin
+outlierVariance µ σ a = OutlierVariance effect desc varOutMin
   where
-    effect | varOutMin < 0.01 = Unaffected
-           | varOutMin < 0.1  = Slight
-           | varOutMin < 0.5  = Moderate
-           | otherwise        = Severe
+    (# effect, desc #) | varOutMin < 0.01 = (# Unaffected, "no" #)
+                       | varOutMin < 0.1  = (# Slight,     "slight" #)
+                       | varOutMin < 0.5  = (# Moderate,   "moderate" #)
+                       | otherwise        = (# Severe,     "severe" #)
     varOutMin = (minBy varOut 1 (minBy cMax 0 µgMin)) / σb2
     varOut c  = (ac / a) * (σb2 - ac * σg2) where ac = a - c
     σb        = B.estPoint σ

Criterion/Analysis/Types.hs

 data OutlierVariance = OutlierVariance {
       ovEffect   :: OutlierEffect
     -- ^ Qualitative description of effect.
+    , ovDesc     :: String
+    -- ^ Brief textual description of effect.
     , ovFraction :: Double
     -- ^ Quantitative description of effect (a fraction between 0 and 1).
     } deriving (Eq, Read, Show, Typeable, Data)
 
 instance NFData OutlierVariance where
-    rnf OutlierVariance{..} = rnf ovEffect `seq` rnf ovFraction
+    rnf OutlierVariance{..} = rnf ovEffect `seq` rnf ovDesc `seq` rnf ovFraction
 
 -- | Result of a bootstrap analysis of a non-parametric sample.
 data SampleAnalysis = SampleAnalysis {