1 module HpcShowTix (showtix_plugin) where
8 import qualified HpcSet as Set
10 showtix_options :: FlagOptSeq
18 showtix_plugin :: Plugin
19 showtix_plugin = Plugin { name = "show"
20 , usage = "[OPTION] .. <TIX_FILE> [<MODULE> [<MODULE> ..]]"
21 , options = showtix_options
22 , summary = "Show .tix file in readable, verbose format"
23 , implementation = showtix_main
24 , init_flags = default_flags
25 , final_flags = default_final_flags
29 showtix_main :: Flags -> [String] -> IO ()
30 showtix_main _ [] = hpcError showtix_plugin $ "no .tix file or executable name specified"
31 showtix_main flags (prog:modNames) = do
33 { includeMods = Set.fromList modNames
37 optTixs <- readTix (getTixFileName prog)
39 Nothing -> hpcError showtix_plugin $ "could not read .tix file : " ++ prog
42 [ do mix <- readMixWithFlags hpcflags1 (Right tix)
45 , allowModule hpcflags1 (tixModuleName tix)
48 let rjust n str = take (n - length str) (repeat ' ') ++ str
49 let ljust n str = str ++ take (n - length str) (repeat ' ')
51 sequence_ [ sequence_ [ putStrLn (rjust 5 (show ix) ++ " " ++
52 rjust 10 (show count) ++ " " ++
53 ljust 20 modName ++ " " ++ rjust 20 (show pos) ++ " " ++ show lab)
54 | (count,ix,(pos,lab)) <- zip3 tixs' [(0::Int)..] entries
56 | ( TixModule modName _hash1 _ tixs'
57 , Mix _file _timestamp _hash2 _tab entries