buildbox-tools (empty) → 1.2.0.0
raw patch · 4 files changed
+108/−0 lines, 4 filesdep +basedep +buildboxdep +parseargssetup-changed
Dependencies added: base, buildbox, parseargs
Files
- LICENSE +24/−0
- Setup.hs +2/−0
- buildbox-tools.cabal +27/−0
- results/Main.hs +55/−0
+ LICENSE view
@@ -0,0 +1,24 @@+Copyright (c) 2010, University of New South Wales.+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:+ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ * Neither the name of the University of New South Wales nor the+ names of its contributors may be used to endorse or promote products+ derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ buildbox-tools.cabal view
@@ -0,0 +1,27 @@+Name: buildbox-tools+Version: 1.2.0.0+License: BSD3+License-file: LICENSE+Author: Ben Lippmeier+Maintainer: Ben Lippmeier <benl@ouroborus.net>+Build-Type: Simple+Cabal-Version: >=1.6+Stability: experimental+Category: Development, Testing+Homepage: http://code.haskell.org/~benl/code/buildbox-head+Description:+ Tools for working with buildbox benchmark result files.++Synopsis:+ Tools for working with buildbox benchmark result files.++Tested-with:+ GHC == 6.12.1++Executable buildbox-results+ Build-depends: + base == 4.*,+ buildbox == 1.2.*,+ parseargs == 0.1.*+ Main-is: Main.hs+ hs-source-dirs: results
+ results/Main.hs view
@@ -0,0 +1,55 @@+{-# LANGUAGE ScopedTypeVariables, PatternGuards #-}++import Args+import BuildBox+import BuildBox.FileFormat.BuildResults+import System.Console.ParseArgs hiding (args)+import Data.List++main :: IO ()+main + = do args <- parseArgsIO ArgsTrailing resultsArgs+ mainWithArgs args++mainWithArgs :: Args ResultsArg -> IO ()+mainWithArgs args++ -- Print usage help+ | gotArg args ArgHelp+ = usageError args ""++ -- Dump a results file.+ | Just fileName <- getArg args ArgDump+ , [] <- argsRest args+ = do contents <- readFile fileName+ let results = (read contents) :: BuildResults+ putStrLn $ render $ ppr results++ -- Compare two results files.+ | gotArg args ArgCompare+ = do let fileNames = argsRest args+ contentss <- mapM readFile fileNames++ let (results :: [BuildResults])+ = map read contentss+ + let [baseline, current] + = map buildResultBench results++ putStrLn $ render $ pprComparisons baseline current++ -- Merge two results files, prefering benchmark results on the left.+ -- The time and environment fields are taken from the file on the right.+ | gotArg args ArgMerge+ = do + -- Read all the files.+ let fileNames = argsRest args+ contentss <- mapM readFile fileNames+ let (results :: [BuildResults])+ = map read contentss+ + print $ mergeResults results++ | otherwise+ = usageError args "Nothing to do...\n"+