1 module HpcShowTix (showtix_plugin) where
9 import qualified HpcSet as Set
18 showtix_plugin = Plugin { name = "show"
19 , usage = "[OPTION] .. <TIX_FILE> [<MODULE> [<MODULE> ..]]"
20 , options = showtix_options
21 , summary = "Show .tix file in readable, verbose format"
22 , implementation = showtix_main
23 , init_flags = default_flags
24 , final_flags = default_final_flags
29 showtix_main flags [] = hpcError showtix_plugin $ "no .tix file or executable name specified"
30 showtix_main flags (prog:modNames) = do
32 { includeMods = Set.fromList modNames
36 optTixs <- readTix (getTixFileName prog)
38 Nothing -> hpcError showtix_plugin $ "could not read .tix file : " ++ prog
41 [ do mix <- readMixWithFlags hpcflags1 (tixModuleName tix)
44 , allowModule hpcflags1 (tixModuleName tix)
47 let rjust n str = take (n - length str) (repeat ' ') ++ str
48 let ljust n str = str ++ take (n - length str) (repeat ' ')
50 sequence_ [ sequence_ [ putStrLn (rjust 5 (show ix) ++ " " ++
51 rjust 10 (show count) ++ " " ++
52 ljust 20 modName ++ " " ++ rjust 20 (show pos) ++ " " ++ show lab)
53 | (count,ix,(pos,lab)) <- zip3 tixs [(0::Int)..] entries
55 | ( TixModule modName hash _ tixs
56 , Mix _file _timestamp _hash _tab entries