complexity 0.1.2 → 0.1.3
raw patch · 3 files changed
+36/−46 lines, 3 filesdep ~Chart
Dependency ranges changed: Chart
Files
- Test/Complexity/Chart.hs +33/−43
- complexity.cabal +2/−2
- example.hs +1/−1
Test/Complexity/Chart.hs view
@@ -12,21 +12,12 @@ import Data.List (intercalate) import Data.Colour-import qualified Data.Colour.Names as CN-import Data.Colour.SRGB+import Data.Colour.Names import Test.Complexity.Base ( MeasurementStats(..) , Stats(..) ) --colourToCairo :: Colour Double -> Color-colourToCairo c = let rgb = toSRGB c- in Color { c_r = channelRed rgb- , c_g = channelGreen rgb- , c_b = channelBlue rgb- }- statsToChart :: [(MeasurementStats, Colour Double)] -> Layout1 Double Double statsToChart [] = defaultLayout1 statsToChart xs = layout1_title ^= intercalate ", " [msDesc | (MeasurementStats {msDesc}, _) <- xs]@@ -37,63 +28,62 @@ quickStatsToChart :: [MeasurementStats] -> Layout1 Double Double quickStatsToChart xs = statsToChart $ zip xs $ cycle colours- where colours = [ CN.blue- , CN.red- , CN.green- , CN.darkgoldenrod- , CN.orchid- , CN.sienna- , CN.darkcyan- , CN.olivedrab- , CN.silver+ where colours = [ blue+ , red+ , green+ , darkgoldenrod+ , orchid+ , sienna+ , darkcyan+ , olivedrab+ , silver ] statsToPlots :: Colour Double -> MeasurementStats -> [Plot Double Double]-statsToPlots c stats = --[ plot_legend ^= [] $ toPlot cpuMinMax- --, plot_legend ^= [] $ toPlot cpuMin- --, plot_legend ^= [] $ toPlot cpuMax- --] ++- [ toPlot cpuMean+statsToPlots c stats = [ plot_legend ^= [] $ toPlot cpuMinMax+ , plot_legend ^= [] $ toPlot cpuMin+ , plot_legend ^= [] $ toPlot cpuMax+ , toPlot cpuMean , plot_legend ^= [] $ toPlot cpuErr , plot_legend ^= [] $ toPlot cpuMeanPts ]- where colour_normal = colourToCairo c- colour_dark = colourToCairo $ blend 0.5 c CN.black- colour_light = colourToCairo $ blend 0.7 c CN.white--- colour_lighter = colourToCairo $ blend 0.5 c CN.white--- colour_lightest = colourToCairo $ blend 0.3 c CN.white+ where meanLineColour = opaque c+ meanPointColour = opaque $ blend 0.5 c black+ stdDevColour = withOpacity c 0.7+ minMaxEdgeColour = withOpacity c 0.2+ minMaxAreaColour = withOpacity c 0.05 cpuMean = plot_lines_values ^= [zip xs ys_cpuMean2]- $ plot_lines_style .> line_color ^= colour_normal+ $ plot_lines_style .> line_color ^= meanLineColour $ plot_lines_title ^= msDesc stats $ defaultPlotLines --- cpuMin = plot_lines_values ^= [zip xs ys_cpuMin]--- $ plot_lines_style .> line_color ^= colour_lighter--- $ defaultPlotLines+ cpuMin = plot_lines_values ^= [zip xs ys_cpuMin]+ $ plot_lines_style .> line_color ^= minMaxEdgeColour+ $ defaultPlotLines --- cpuMax = plot_lines_values ^= [zip xs ys_cpuMax]--- $ plot_lines_style .> line_color ^= colour_lighter--- $ defaultPlotLines+ cpuMax = plot_lines_values ^= [zip xs ys_cpuMax]+ $ plot_lines_style .> line_color ^= minMaxEdgeColour+ $ defaultPlotLines cpuMeanPts = plot_points_values ^= zip xs ys_cpuMean2- $ plot_points_style ^= filledCircles 2 colour_dark+ $ plot_points_style ^= filledCircles 2 meanPointColour $ defaultPlotPoints --- cpuMinMax = plot_fillbetween_values ^= zip xs (zip ys_cpuMin ys_cpuMax)--- $ plot_fillbetween_style ^= solidFillStyle colour_lightest--- $ defaultPlotFillBetween+ cpuMinMax = plot_fillbetween_values ^= zip xs (zip ys_cpuMin ys_cpuMax)+ $ plot_fillbetween_style ^= solidFillStyle minMaxAreaColour+ $ defaultPlotFillBetween cpuErr = plot_errbars_values ^= [symErrPoint x y 0 e | (x, y, e) <- zip3 xs ys_cpuMean vs_cpuStdDev]- $ plot_errbars_line_style .> line_color ^= colour_light+ $ plot_errbars_line_style .> line_color ^= stdDevColour $ defaultPlotErrBars ps = msSamples stats xs = map (fromIntegral . fst) ps ys_cpuMean = map (statsMean . snd) ps ys_cpuMean2 = map (statsMean2 . snd) ps--- ys_cpuMin = map (statsMin . snd) ps--- ys_cpuMax = map (statsMax . snd) ps+ ys_cpuMin = map (statsMin . snd) ps+ ys_cpuMax = map (statsMax . snd) ps vs_cpuStdDev = map (statsStdDev . snd) ps showStatsChart :: [MeasurementStats] -> IO ()
complexity.cabal view
@@ -1,5 +1,5 @@ name: complexity-version: 0.1.2+version: 0.1.3 cabal-version: >= 1.6 build-type: Simple stability: experimental@@ -24,7 +24,7 @@ , data-accessor >= 0.2 , pretty >= 1 , colour >= 2- , Chart >= 0.1 && <= 10.0.3+ , Chart >= 0.11 && < 0.12 , hstats >= 0.1 && <= 0.3 exposed-modules: Test.Complexity , Test.Complexity.Base
example.hs view
@@ -23,7 +23,7 @@ pseudoRnd p1 p2 n d = iterate (\x -> (p1 * x + p2) `mod` n) d genIntList2 :: InputGen [Int]-genIntList2 n = take (fromInteger n) $ pseudoRnd 16807 0 (2 ^ 31 - 1) 79+genIntList2 n = take (fromInteger n) $ pseudoRnd 16807 0 (2 ^ (31 :: Int) - 1) 79 ------------------------------------------------------------------------------- -- Bunch of fibonacci functions