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