1 module HpcShowTix (showtix_plugin) where
8 import qualified Data.Set as Set
11 [ excludeOpt,includeOpt,hpcDirOpt
15 showtix_plugin = Plugin { name = "show"
16 , usage = "[OPTION] .. <TIX_FILE> [<MODULE> [<MODULE> ..]]"
17 , options = showtix_options
18 , summary = "Show .tix file in readable, verbose format"
19 , implementation = showtix_main
20 , init_flags = default_flags
21 , final_flags = default_final_flags
26 showtix_main flags [] = hpcError showtix_plugin $ "no .tix file or executable name specified"
27 showtix_main flags (prog:modNames) = do
29 { includeMods = Set.fromList modNames
33 optTixs <- readTix (getTixFileName prog)
35 Nothing -> hpcError showtix_plugin $ "could not read .tix file : " ++ prog
37 let modules = map tixModuleName tixs
40 [ readMix (hpcDirs hpcflags1) modName -- hard wired to .hpc for now
42 , allowModule hpcflags1 modName
45 let rjust n str = take (n - length str) (repeat ' ') ++ str
46 let ljust n str = str ++ take (n - length str) (repeat ' ')
48 sequence_ [ sequence_ [ putStrLn (rjust 5 (show ix) ++ " " ++
49 rjust 10 (show count) ++ " " ++
50 ljust 20 modName ++ " " ++ rjust 20 (show pos) ++ " " ++ show lab)
51 | (count,ix,(pos,lab)) <- zip3 tixs [(0::Int)..] entries
53 | ( TixModule modName hash _ tixs
54 , Mix _file _timestamp _hash _tab entries