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
61 usageHeader = "usage: nofib-analyse [OPTION...] <logfile1> <logfile2> ..."
64 usage = usageInfo usageHeader argInfo
66 argInfo :: [ OptDescr CLIFlags ]
68 [ Option ['?'] ["help"] (NoArg OptHelp)
69 "Display this message"
70 , Option ['a'] ["ascii"] (NoArg OptASCIIOutput)
71 "Produce ASCII output (default)"
72 , Option ['h'] ["html"] (NoArg OptHTMLOutput)
74 , Option ['i'] ["ignore"] (ReqArg (OptIgnoreSmallTimes . read) "secs")
75 "Ignore runtimes smaller than <secs>"
76 , Option ['d'] ["deviations"] (NoArg OptDeviations)
77 "Display deviations (default)"
78 , Option ['l'] ["latex"] (NoArg OptLaTeXOutput)
79 "Produce LaTeX output"
80 , Option [] ["columns"] (ReqArg OptColumns "COLUMNS")
81 "Specify columns for summary table (comma separates)"
82 , Option [] ["rows"] (ReqArg OptRows "ROWS")
83 "Specify rows for summary table (comma separates)"
84 , Option ['n'] ["nodeviations"] (NoArg OptNoDeviations)
86 , Option ['t'] ["title"] (ReqArg OptTitle "title")
87 "Specify report title"