Permalink
Browse files

Added new table output that dumps all results

The new format dumps the values of each column for each input file
in a single table. The format is intended to be used as input for
another program (such as R).
  • Loading branch information...
1 parent 5aa4a14 commit 131c884e5c9ae4b55121906daf5ec50ae70f160d @dmpots committed Feb 24, 2011
View
4 tools/fibon-analyse/Fibon/Analyse/Analysis.hs
@@ -76,7 +76,7 @@ type NormMethod a = ResultColumn a -> Normalize a
data Normalize a =
NormPercent (ResultColumn a)
| NormRatio (ResultColumn a)
- | NormNone (ResultColumn a) -- ^ For uniform normalization use
+ | NormNone
computeRows :: [(Normalize a, ResultColumn a)]
-> [BenchName]
@@ -119,7 +119,7 @@ computeOneColumn bench (ColSpec _ metric) (normType, resultColumn) =
case normType of
NormPercent base -> normToBase base normalizePercent
NormRatio base -> normToBase base normalizeRatio
- NormNone _ -> return (mkRaw peak)
+ NormNone -> return (mkRaw peak)
where
mkRaw = Basic . Raw
mkNorm = Basic . Norm
View
3 tools/fibon-analyse/Fibon/Analyse/Main.hs
@@ -19,6 +19,7 @@ main = do
tableSpec = optTableSpec opts
putStrLn $ renderSummaryTable rs norm fmt tableSpec
putStrLn $ renderTables rs norm fmt tableSpec
+ putStrLn $ renderFullTable rs norm fmt tableSpec
getCommandLine :: IO (Opt, [FilePath])
@@ -34,4 +35,4 @@ getNormFun o =
case optNormalizeBy o of
ByPercent -> NormPercent
ByRatio -> NormRatio
- ByNone -> NormNone
+ ByNone -> const NormNone
View
26 tools/fibon-analyse/Fibon/Analyse/Output.hs
@@ -2,6 +2,7 @@ module Fibon.Analyse.Output (
OutputFormat(..)
, renderTables
, renderSummaryTable
+ , renderFullTable
)
where
@@ -34,7 +35,7 @@ renderTables rs@(baseline:compares) normMethod fmt tableSpec =
render colSpec =
renderTable (cName colSpec) colNames columns fmt [colSpec]
columns = baselineCol : compareCols
- baselineCol = (NormNone baseline, baseline)
+ baselineCol = (NormNone, baseline)
compareCols = [(normMethod baseline, c) | c <- compares]
colNames = map resultLabel rs
@@ -50,8 +51,27 @@ renderSummaryTable [base, peak] normMethod fmt tableSpec =
colNames = map cName tableSpec
renderSummaryTable _ _ _ _ = ""
--- | Renders a table. The number of columns is
--- length (tableData) * length (TableSpec).
+-- | Render a table containing all of the results. This table is intended to be
+-- fed to other programs (such as excel) for further analysis. The table will
+-- be rendered as follows. For each column in the table spec, we will render
+-- a column for each result in the [ResultColumn] list.
+-- The total number of columns is length (tableData) * length (TableSpec).
+renderFullTable :: [ResultColumn a] -> NormMethod a -> OutputFormat -> TableSpec a -> String
+renderFullTable [] _ _fmt _spec = ""
+renderFullTable rs@(baseline:compares) normMethod fmt tableSpec =
+ renderTable "Full Data" colNames columns fmt tableSpec
+ where
+ columns = baselineCol : compareCols
+ baselineCol = (NormNone, baseline)
+ compareCols = [(normMethod baseline, c) | c <- compares]
+ -- !! Subtle invariant !! These names are mapped to the columns because
+ -- of the order they are computed in computeOneRow in Analysis.hs. This is
+ -- not such a great thing, but it is easy for now.
+ colNames = concat $ map (\s -> map (\r -> mkName s r) rs) tableSpec
+ mkName colSpec resultCol = cName colSpec ++ "." ++ resultLabel resultCol
+
+-- | Renders a table. The number of columns rendered will be equal to the
+-- length of the columnNames list.
renderTable :: String -- ^ Table name
-> [String] -- ^ Column names
-> [(Normalize a, ResultColumn a)] -- ^ Table data

0 comments on commit 131c884

Please sign in to comment.