1 -----------------------------------------------------------------------------
4 -- (c) Simon Marlow 2005
5 -----------------------------------------------------------------------------
9 flags, other_args, cmdline_errors,
10 devs, nodevs, tooquick_threshold, reportTitle,
15 import System.Console.GetOpt
16 import System.Environment ( getArgs )
17 import System.IO.Unsafe ( unsafePerformIO )
19 -----------------------------------------------------------------------------
20 -- Command line arguments
23 args = unsafePerformIO getArgs
26 other_args :: [String]
27 cmdline_errors :: [String]
28 (flags, other_args, cmdline_errors) = getOpt Permute argInfo args
30 default_tooquick_threshold, tooquick_threshold :: Float
31 default_tooquick_threshold = 0.2 {- secs -}
33 = case [ i | OptIgnoreSmallTimes i <- flags ] of
34 [] -> default_tooquick_threshold
38 devs = OptDeviations `elem` flags
39 nodevs = OptNoDeviations `elem` flags
41 default_title, reportTitle :: String
42 default_title = "NoFib Results"
43 reportTitle = case [ t | OptTitle t <- flags ] of
51 | OptIgnoreSmallTimes Float
63 usageHeader = "usage: nofib-analyse [OPTION...] <logfile1> <logfile2> ..."
66 usage = usageInfo usageHeader argInfo
68 argInfo :: [ OptDescr CLIFlags ]
70 [ Option ['?'] ["help"] (NoArg OptHelp)
71 "Display this message"
72 , Option ['a'] ["ascii"] (NoArg OptASCIIOutput)
73 "Produce ASCII output (default)"
74 , Option ['h'] ["html"] (NoArg OptHTMLOutput)
76 , Option ['i'] ["ignore"] (ReqArg (OptIgnoreSmallTimes . read) "secs")
77 "Ignore runtimes smaller than <secs>"
78 , Option ['d'] ["deviations"] (NoArg OptDeviations)
79 "Display deviations (default)"
80 , Option ['l'] ["latex"] (NoArg OptLaTeXOutput)
81 "Produce LaTeX output"
82 , Option [] ["columns"] (ReqArg OptColumns "COLUMNS")
83 "Specify columns for summary table (comma separates)"
84 , Option [] ["rows"] (ReqArg OptRows "ROWS")
85 "Specify rows for summary table (comma separates)"
86 , Option [] ["csv"] (ReqArg OptCSV "TABLE")
87 "Output a single table in CSV format"
88 , Option [] ["no-normalise"] (NoArg OptNoNormalise)
89 "Do not normalise to the baseline"
90 , Option ['n'] ["nodeviations"] (NoArg OptNoDeviations)
92 , Option ['t'] ["title"] (ReqArg OptTitle "title")
93 "Specify report title"