ghc-prof 1.3.0.2 → 1.4.0
raw patch · 9 files changed
+121/−100 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- GHC.Prof: AggregateCostCentre :: !Text -> !Text -> !(Maybe Text) -> !(Maybe Integer) -> !Scientific -> !Scientific -> !(Maybe Integer) -> !(Maybe Integer) -> AggregateCostCentre
- GHC.Prof: [aggregateCostCentreAlloc] :: AggregateCostCentre -> !Scientific
- GHC.Prof: [aggregateCostCentreBytes] :: AggregateCostCentre -> !(Maybe Integer)
- GHC.Prof: [aggregateCostCentreEntries] :: AggregateCostCentre -> !(Maybe Integer)
- GHC.Prof: [aggregateCostCentreModule] :: AggregateCostCentre -> !Text
- GHC.Prof: [aggregateCostCentreName] :: AggregateCostCentre -> !Text
- GHC.Prof: [aggregateCostCentreSrc] :: AggregateCostCentre -> !(Maybe Text)
- GHC.Prof: [aggregateCostCentreTicks] :: AggregateCostCentre -> !(Maybe Integer)
- GHC.Prof: [aggregateCostCentreTime] :: AggregateCostCentre -> !Scientific
- GHC.Prof: aggregateCostCentres :: Profile -> [AggregateCostCentre]
- GHC.Prof: aggregateCostCentresOrderBy :: Ord a => (AggregateCostCentre -> a) -> Profile -> [AggregateCostCentre]
- GHC.Prof: data AggregateCostCentre
- GHC.Prof.CostCentreTree: aggregateCostCentres :: Profile -> [AggregateCostCentre]
- GHC.Prof.CostCentreTree: aggregateCostCentresOrderBy :: Ord a => (AggregateCostCentre -> a) -> Profile -> [AggregateCostCentre]
- GHC.Prof.CostCentreTree: buildAggregateCostCentresOrderBy :: Ord a => (AggregateCostCentre -> a) -> CostCentreTree -> [AggregateCostCentre]
- GHC.Prof.Parser: aggregateCostCentre :: HeaderParams -> Parser AggregateCostCentre
- GHC.Prof.Types: AggregateCostCentre :: !Text -> !Text -> !(Maybe Text) -> !(Maybe Integer) -> !Scientific -> !Scientific -> !(Maybe Integer) -> !(Maybe Integer) -> AggregateCostCentre
- GHC.Prof.Types: [aggregateCostCentreAlloc] :: AggregateCostCentre -> !Scientific
- GHC.Prof.Types: [aggregateCostCentreBytes] :: AggregateCostCentre -> !(Maybe Integer)
- GHC.Prof.Types: [aggregateCostCentreEntries] :: AggregateCostCentre -> !(Maybe Integer)
- GHC.Prof.Types: [aggregateCostCentreModule] :: AggregateCostCentre -> !Text
- GHC.Prof.Types: [aggregateCostCentreName] :: AggregateCostCentre -> !Text
- GHC.Prof.Types: [aggregateCostCentreSrc] :: AggregateCostCentre -> !(Maybe Text)
- GHC.Prof.Types: [aggregateCostCentreTicks] :: AggregateCostCentre -> !(Maybe Integer)
- GHC.Prof.Types: [aggregateCostCentreTime] :: AggregateCostCentre -> !Scientific
- GHC.Prof.Types: data AggregateCostCentre
- GHC.Prof.Types: instance GHC.Classes.Eq GHC.Prof.Types.AggregateCostCentre
- GHC.Prof.Types: instance GHC.Classes.Ord GHC.Prof.Types.AggregateCostCentre
- GHC.Prof.Types: instance GHC.Show.Show GHC.Prof.Types.AggregateCostCentre
+ GHC.Prof: AggregatedCostCentre :: !Text -> !Text -> !(Maybe Text) -> !(Maybe Integer) -> !Scientific -> !Scientific -> !(Maybe Integer) -> !(Maybe Integer) -> AggregatedCostCentre
+ GHC.Prof: [aggregatedCostCentreAlloc] :: AggregatedCostCentre -> !Scientific
+ GHC.Prof: [aggregatedCostCentreBytes] :: AggregatedCostCentre -> !(Maybe Integer)
+ GHC.Prof: [aggregatedCostCentreEntries] :: AggregatedCostCentre -> !(Maybe Integer)
+ GHC.Prof: [aggregatedCostCentreModule] :: AggregatedCostCentre -> !Text
+ GHC.Prof: [aggregatedCostCentreName] :: AggregatedCostCentre -> !Text
+ GHC.Prof: [aggregatedCostCentreSrc] :: AggregatedCostCentre -> !(Maybe Text)
+ GHC.Prof: [aggregatedCostCentreTicks] :: AggregatedCostCentre -> !(Maybe Integer)
+ GHC.Prof: [aggregatedCostCentreTime] :: AggregatedCostCentre -> !Scientific
+ GHC.Prof: aggregatedCostCentres :: Profile -> [AggregatedCostCentre]
+ GHC.Prof: aggregatedCostCentresOrderBy :: Ord a => (AggregatedCostCentre -> a) -> Profile -> [AggregatedCostCentre]
+ GHC.Prof: data AggregatedCostCentre
+ GHC.Prof.CostCentreTree: aggregatedCostCentres :: Profile -> [AggregatedCostCentre]
+ GHC.Prof.CostCentreTree: aggregatedCostCentresOrderBy :: Ord a => (AggregatedCostCentre -> a) -> Profile -> [AggregatedCostCentre]
+ GHC.Prof.CostCentreTree: buildAggregatedCostCentresOrderBy :: Ord a => (AggregatedCostCentre -> a) -> CostCentreTree -> [AggregatedCostCentre]
+ GHC.Prof.Parser: aggregatedCostCentre :: HeaderParams -> Parser AggregatedCostCentre
+ GHC.Prof.Types: AggregatedCostCentre :: !Text -> !Text -> !(Maybe Text) -> !(Maybe Integer) -> !Scientific -> !Scientific -> !(Maybe Integer) -> !(Maybe Integer) -> AggregatedCostCentre
+ GHC.Prof.Types: [aggregatedCostCentreAlloc] :: AggregatedCostCentre -> !Scientific
+ GHC.Prof.Types: [aggregatedCostCentreBytes] :: AggregatedCostCentre -> !(Maybe Integer)
+ GHC.Prof.Types: [aggregatedCostCentreEntries] :: AggregatedCostCentre -> !(Maybe Integer)
+ GHC.Prof.Types: [aggregatedCostCentreModule] :: AggregatedCostCentre -> !Text
+ GHC.Prof.Types: [aggregatedCostCentreName] :: AggregatedCostCentre -> !Text
+ GHC.Prof.Types: [aggregatedCostCentreSrc] :: AggregatedCostCentre -> !(Maybe Text)
+ GHC.Prof.Types: [aggregatedCostCentreTicks] :: AggregatedCostCentre -> !(Maybe Integer)
+ GHC.Prof.Types: [aggregatedCostCentreTime] :: AggregatedCostCentre -> !Scientific
+ GHC.Prof.Types: data AggregatedCostCentre
+ GHC.Prof.Types: instance GHC.Classes.Eq GHC.Prof.Types.AggregatedCostCentre
+ GHC.Prof.Types: instance GHC.Classes.Ord GHC.Prof.Types.AggregatedCostCentre
+ GHC.Prof.Types: instance GHC.Show.Show GHC.Prof.Types.AggregatedCostCentre
- GHC.Prof: Profile :: !LocalTime -> !Text -> !TotalTime -> !TotalAlloc -> [AggregateCostCentre] -> !CostCentreTree -> Profile
+ GHC.Prof: Profile :: !LocalTime -> !Text -> !TotalTime -> !TotalAlloc -> [AggregatedCostCentre] -> !CostCentreTree -> Profile
- GHC.Prof: [profileTopCostCentres] :: Profile -> [AggregateCostCentre]
+ GHC.Prof: [profileTopCostCentres] :: Profile -> [AggregatedCostCentre]
- GHC.Prof: aggregateCallSites :: Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])
+ GHC.Prof: aggregateCallSites :: Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre])
- GHC.Prof: aggregateCallSitesOrderBy :: Ord a => (CallSite AggregateCostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])
+ GHC.Prof: aggregateCallSitesOrderBy :: Ord a => (CallSite AggregatedCostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre])
- GHC.Prof: callSites :: Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite CostCentre])
+ GHC.Prof: callSites :: Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite CostCentre])
- GHC.Prof: callSitesOrderBy :: Ord a => (CallSite CostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite CostCentre])
+ GHC.Prof: callSitesOrderBy :: Ord a => (CallSite CostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite CostCentre])
- GHC.Prof.CostCentreTree: aggregateCallSites :: Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])
+ GHC.Prof.CostCentreTree: aggregateCallSites :: Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre])
- GHC.Prof.CostCentreTree: aggregateCallSitesOrderBy :: Ord a => (CallSite AggregateCostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])
+ GHC.Prof.CostCentreTree: aggregateCallSitesOrderBy :: Ord a => (CallSite AggregatedCostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre])
- GHC.Prof.CostCentreTree: buildAggregateCallSitesOrderBy :: Ord a => (CallSite AggregateCostCentre -> a) -> Text -> Text -> CostCentreTree -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])
+ GHC.Prof.CostCentreTree: buildAggregateCallSitesOrderBy :: Ord a => (CallSite AggregatedCostCentre -> a) -> Text -> Text -> CostCentreTree -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre])
- GHC.Prof.CostCentreTree: buildCallSitesOrderBy :: Ord a => (CallSite CostCentre -> a) -> Text -> Text -> CostCentreTree -> Maybe (AggregateCostCentre, [CallSite CostCentre])
+ GHC.Prof.CostCentreTree: buildCallSitesOrderBy :: Ord a => (CallSite CostCentre -> a) -> Text -> Text -> CostCentreTree -> Maybe (AggregatedCostCentre, [CallSite CostCentre])
- GHC.Prof.CostCentreTree: callSites :: Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite CostCentre])
+ GHC.Prof.CostCentreTree: callSites :: Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite CostCentre])
- GHC.Prof.CostCentreTree: callSitesOrderBy :: Ord a => (CallSite CostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregateCostCentre, [CallSite CostCentre])
+ GHC.Prof.CostCentreTree: callSitesOrderBy :: Ord a => (CallSite CostCentre -> a) -> Text -> Text -> Profile -> Maybe (AggregatedCostCentre, [CallSite CostCentre])
- GHC.Prof.Parser: topCostCentres :: Parser [AggregateCostCentre]
+ GHC.Prof.Parser: topCostCentres :: Parser [AggregatedCostCentre]
- GHC.Prof.Types: CostCentreTree :: !(IntMap CostCentre) -> !(IntMap CostCentreNo) -> !(IntMap (Set CostCentre)) -> !(Map (Text, Text) (Set CostCentre)) -> !(Map Text (Map Text AggregateCostCentre)) -> CostCentreTree
+ GHC.Prof.Types: CostCentreTree :: !(IntMap CostCentre) -> !(IntMap CostCentreNo) -> !(IntMap (Set CostCentre)) -> !(Map (Text, Text) (Set CostCentre)) -> !(Map Text (Map Text AggregatedCostCentre)) -> CostCentreTree
- GHC.Prof.Types: Profile :: !LocalTime -> !Text -> !TotalTime -> !TotalAlloc -> [AggregateCostCentre] -> !CostCentreTree -> Profile
+ GHC.Prof.Types: Profile :: !LocalTime -> !Text -> !TotalTime -> !TotalAlloc -> [AggregatedCostCentre] -> !CostCentreTree -> Profile
- GHC.Prof.Types: [costCentreAggregate] :: CostCentreTree -> !(Map Text (Map Text AggregateCostCentre))
+ GHC.Prof.Types: [costCentreAggregate] :: CostCentreTree -> !(Map Text (Map Text AggregatedCostCentre))
- GHC.Prof.Types: [profileTopCostCentres] :: Profile -> [AggregateCostCentre]
+ GHC.Prof.Types: [profileTopCostCentres] :: Profile -> [AggregatedCostCentre]
Files
- CHANGELOG.md +5/−0
- README.md +13/−0
- bin/dump.hs +6/−6
- ghc-prof.cabal +5/−2
- src/GHC/Prof.hs +3/−3
- src/GHC/Prof/CostCentreTree.hs +35/−35
- src/GHC/Prof/Parser.hs +29/−29
- src/GHC/Prof/Types.hs +11/−11
- tests/Regression.hs +14/−14
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Revision history for ghc-events++## 1.4.0 (2017-02-14)++* Rename AggregateCostCentre to AggregatedCostCentre
+ README.md view
@@ -0,0 +1,13 @@+# ghc-prof: Library for parsing GHC time and allocation profiling reports++[](https://hackage.haskell.org/package/ghc-prof)+[](https://hackage.haskell.org/package/ghc-prof)+[](http://stackage.org/lts/package/ghc-prof)+[](http://stackage.org/nightly/package/ghc-prof)+[](https://travis-ci.org/maoe/ghc-prof)+[](https://gitter.im/maoe/ghc-prof)++## Applications++* [profiteur](https://hackage.haskell.org/package/profiteur)+* [viewprof](https://hackage.haskell.org/package/viewprof)
bin/dump.hs view
@@ -22,7 +22,7 @@ Left reason -> fail reason Right prof -> case optMode opts of AggregateMode ->- traverse_ (putStrLn . makeAggregateCCName) $ aggregateCostCentres prof+ traverse_ (putStrLn . makeAggregateCCName) $ aggregatedCostCentres prof TreeMode -> case restArgs of [] -> traverse_ putStrLn $ drawTree . fmap makeCCName <$> costCentres prof@@ -44,13 +44,13 @@ (showScientific $ costCentreInhAlloc cc) (showScientific $ costCentreIndAlloc cc) -makeAggregateCCName :: AggregateCostCentre -> String+makeAggregateCCName :: AggregatedCostCentre -> String makeAggregateCCName aggregate = printf "%s%%\t%s%%\t%s.%s"- (showScientific $ aggregateCostCentreTime aggregate)- (showScientific $ aggregateCostCentreAlloc aggregate)- (T.unpack $ aggregateCostCentreModule aggregate)- (T.unpack $ aggregateCostCentreName aggregate)+ (showScientific $ aggregatedCostCentreTime aggregate)+ (showScientific $ aggregatedCostCentreAlloc aggregate)+ (T.unpack $ aggregatedCostCentreModule aggregate)+ (T.unpack $ aggregatedCostCentreName aggregate) showScientific :: Scientific -> String showScientific = formatScientific Fixed Nothing
ghc-prof.cabal view
@@ -1,5 +1,5 @@ name: ghc-prof-version: 1.3.0.2+version: 1.4.0 synopsis: Library for parsing GHC time and allocation profiling reports description: Library for parsing GHC time and allocation profiling reports homepage: https://github.com/maoe/ghc-prof@@ -7,9 +7,12 @@ license-file: LICENSE author: Mitsutoshi Aoe maintainer: Mitsutoshi Aoe <maoe@foldr.in>-copyright: Copyright (C) 2013-2016 Mitsutoshi Aoe+copyright: Copyright (C) 2013-2017 Mitsutoshi Aoe category: Development build-type: Simple+extra-source-files:+ CHANGELOG.md+ README.md cabal-version: >=1.10 tested-with: GHC >= 7.6 && <= 8.0.2
src/GHC/Prof.hs view
@@ -6,8 +6,8 @@ -- * Cost-centre tree , CostCentreTree- , aggregateCostCentres- , aggregateCostCentresOrderBy+ , aggregatedCostCentres+ , aggregatedCostCentresOrderBy , costCentres , costCentresOrderBy , aggregateCallSites@@ -21,7 +21,7 @@ , Profile(..) , TotalTime(..) , TotalAlloc(..)- , AggregateCostCentre(..)+ , AggregatedCostCentre(..) , CostCentre(..) , CostCentreNo , CallSite(..)
src/GHC/Prof/CostCentreTree.hs view
@@ -5,8 +5,8 @@ module GHC.Prof.CostCentreTree ( -- * Cost center breakdown -- ** Aggregate cost centres- aggregateCostCentres- , aggregateCostCentresOrderBy+ aggregatedCostCentres+ , aggregatedCostCentresOrderBy -- ** Cost centre trees , costCentres@@ -26,7 +26,7 @@ , aggregateModulesOrderBy -- * Low level functions- , buildAggregateCostCentresOrderBy+ , buildAggregatedCostCentresOrderBy , buildCostCentresOrderBy , buildCallSitesOrderBy , buildAggregateCallSitesOrderBy@@ -58,21 +58,21 @@ -- | Build a list of cost-centres from a profiling report ordered by the time -- spent and the amount of allocation.-aggregateCostCentres :: Profile -> [AggregateCostCentre]-aggregateCostCentres = aggregateCostCentresOrderBy sortKey+aggregatedCostCentres :: Profile -> [AggregatedCostCentre]+aggregatedCostCentres = aggregatedCostCentresOrderBy sortKey where- sortKey = aggregateCostCentreTime &&& aggregateCostCentreAlloc+ sortKey = aggregatedCostCentreTime &&& aggregatedCostCentreAlloc -- | Build a list of cost-centres from a profling report ordered by the given -- key.-aggregateCostCentresOrderBy+aggregatedCostCentresOrderBy :: Ord a- => (AggregateCostCentre -> a)+ => (AggregatedCostCentre -> a) -- ^ Sorting key function -> Profile- -> [AggregateCostCentre]-aggregateCostCentresOrderBy sortKey =- buildAggregateCostCentresOrderBy sortKey . profileCostCentreTree+ -> [AggregatedCostCentre]+aggregatedCostCentresOrderBy sortKey =+ buildAggregatedCostCentresOrderBy sortKey . profileCostCentreTree -- | Build a tree of cost-centres from a profiling report. costCentres :: Profile -> Maybe (Tree CostCentre)@@ -102,26 +102,26 @@ -> Text -- ^ Module name -> Profile- -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])+ -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre]) aggregateCallSites = aggregateCallSitesOrderBy sortKey where sortKey = callSiteContribTime &&& callSiteContribAlloc- &&& aggregateCostCentreTime . callSiteCostCentre- &&& aggregateCostCentreAlloc . callSiteCostCentre+ &&& aggregatedCostCentreTime . callSiteCostCentre+ &&& aggregatedCostCentreAlloc . callSiteCostCentre -- | Build a list of call sites (caller functions of a cost centre) aggregated -- by their cost centre names and module names. Call sites are sorted by the -- given key function. aggregateCallSitesOrderBy :: Ord a- => (CallSite AggregateCostCentre -> a)+ => (CallSite AggregatedCostCentre -> a) -- ^ Sorting key function -> Text -- ^ Cost centre name -> Text -- ^ Module name -> Profile- -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])+ -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre]) aggregateCallSitesOrderBy sortKey name modName = buildAggregateCallSitesOrderBy sortKey name modName . profileCostCentreTree @@ -133,7 +133,7 @@ -> Text -- ^ Module name -> Profile- -> Maybe (AggregateCostCentre, [CallSite CostCentre])+ -> Maybe (AggregatedCostCentre, [CallSite CostCentre]) callSites = callSitesOrderBy sortKey where sortKey = callSiteContribTime &&& callSiteContribAlloc@@ -152,7 +152,7 @@ -> Text -- ^ Module name -> Profile- -> Maybe (AggregateCostCentre, [CallSite CostCentre])+ -> Maybe (AggregatedCostCentre, [CallSite CostCentre]) callSitesOrderBy sortKey name modName = buildCallSitesOrderBy sortKey name modName . profileCostCentreTree @@ -176,12 +176,12 @@ ----------------------------------------------------------- -buildAggregateCostCentresOrderBy+buildAggregatedCostCentresOrderBy :: Ord a- => (AggregateCostCentre -> a)+ => (AggregatedCostCentre -> a) -> CostCentreTree- -> [AggregateCostCentre]-buildAggregateCostCentresOrderBy sortKey CostCentreTree {..} =+ -> [AggregatedCostCentre]+buildAggregatedCostCentresOrderBy sortKey CostCentreTree {..} = sortBy (flip compare `on` sortKey) $ concatMap Map.elems $ Map.elems $ costCentreAggregate @@ -208,14 +208,14 @@ buildAggregateCallSitesOrderBy :: Ord a- => (CallSite AggregateCostCentre -> a)+ => (CallSite AggregatedCostCentre -> a) -- ^ Sorting key function -> Text -- ^ Cost centre name -> Text -- ^ Module name -> CostCentreTree- -> Maybe (AggregateCostCentre, [CallSite AggregateCostCentre])+ -> Maybe (AggregatedCostCentre, [CallSite AggregatedCostCentre]) buildAggregateCallSitesOrderBy sortKey name modName tree@CostCentreTree {..} = (,) <$> callee <*> callers where@@ -227,9 +227,9 @@ buildAggregateCallSite :: CostCentreTree- -> Map.Map (Text, Text) (CallSite AggregateCostCentre)+ -> Map.Map (Text, Text) (CallSite AggregatedCostCentre) -> CostCentre- -> Maybe (Map.Map (Text, Text) (CallSite AggregateCostCentre))+ -> Maybe (Map.Map (Text, Text) (CallSite AggregatedCostCentre)) buildAggregateCallSite CostCentreTree {..} parents CostCentre {..} = do parentNo <- IntMap.lookup costCentreNo costCentreParents parent <- IntMap.lookup parentNo costCentreNodes@@ -271,7 +271,7 @@ -> Text -- ^ Module name -> CostCentreTree- -> Maybe (AggregateCostCentre, [CallSite CostCentre])+ -> Maybe (AggregatedCostCentre, [CallSite CostCentre]) buildCallSitesOrderBy sortKey name modName tree@CostCentreTree {..} = (,) <$> callee <*> callers where@@ -311,25 +311,25 @@ costCentreAggregate where aggregateModule modName = Map.foldl' add (emptyAggregateModule modName)- add aggMod AggregateCostCentre {..} = aggMod+ add aggMod AggregatedCostCentre {..} = aggMod { aggregateModuleEntries = seqM $ (+) <$> aggregateModuleEntries aggMod- <*> aggregateCostCentreEntries+ <*> aggregatedCostCentreEntries , aggregateModuleTime =- aggregateModuleTime aggMod + aggregateCostCentreTime+ aggregateModuleTime aggMod + aggregatedCostCentreTime , aggregateModuleAlloc =- aggregateModuleAlloc aggMod + aggregateCostCentreAlloc+ aggregateModuleAlloc aggMod + aggregatedCostCentreAlloc , aggregateModuleTicks = seqM $ (+) <$> aggregateModuleTicks aggMod- <*> aggregateCostCentreTicks+ <*> aggregatedCostCentreTicks , aggregateModuleBytes = seqM $ (+) <$> aggregateModuleBytes aggMod- <*> aggregateCostCentreBytes+ <*> aggregatedCostCentreBytes } lookupAggregate :: Text -- ^ Cost centre name -> Text -- ^ Module name- -> Map.Map Text (Map.Map Text AggregateCostCentre)- -> Maybe AggregateCostCentre+ -> Map.Map Text (Map.Map Text AggregatedCostCentre)+ -> Maybe AggregatedCostCentre lookupAggregate name modName m = Map.lookup modName m >>= Map.lookup name
src/GHC/Prof/Parser.hs view
@@ -13,7 +13,7 @@ , totalTime , totalAlloc , topCostCentres- , aggregateCostCentre+ , aggregatedCostCentre , costCentres , costCentre ) where@@ -151,13 +151,13 @@ return HeaderParams {..} -topCostCentres :: Parser [AggregateCostCentre]+topCostCentres :: Parser [AggregatedCostCentre] topCostCentres = do params <- header; skipSpace- aggregateCostCentre params `sepBy1` endOfLine+ aggregatedCostCentre params `sepBy1` endOfLine -aggregateCostCentre :: HeaderParams -> Parser AggregateCostCentre-aggregateCostCentre HeaderParams {..} = AggregateCostCentre+aggregatedCostCentre :: HeaderParams -> Parser AggregatedCostCentre+aggregatedCostCentre HeaderParams {..} = AggregatedCostCentre <$> symbol <* skipHorizontalSpace -- name <*> symbol <* skipHorizontalSpace -- module <*> source <* skipHorizontalSpace -- src@@ -282,19 +282,19 @@ (costCentreModule node) costCentreAggregate }- aggregate = AggregateCostCentre- { aggregateCostCentreName = costCentreName node- , aggregateCostCentreModule = costCentreModule node- , aggregateCostCentreSrc = costCentreSrc node- , aggregateCostCentreEntries = Just $! costCentreEntries node- , aggregateCostCentreTime = costCentreIndTime node- , aggregateCostCentreAlloc = costCentreIndAlloc node- , aggregateCostCentreTicks = costCentreTicks node- , aggregateCostCentreBytes = costCentreBytes node+ aggregate = AggregatedCostCentre+ { aggregatedCostCentreName = costCentreName node+ , aggregatedCostCentreModule = costCentreModule node+ , aggregatedCostCentreSrc = costCentreSrc node+ , aggregatedCostCentreEntries = Just $! costCentreEntries node+ , aggregatedCostCentreTime = costCentreIndTime node+ , aggregatedCostCentreAlloc = costCentreIndAlloc node+ , aggregatedCostCentreTicks = costCentreTicks node+ , aggregatedCostCentreBytes = costCentreBytes node } updateCostCentre- :: Maybe (Map.Map Text AggregateCostCentre)- -> Map.Map Text AggregateCostCentre+ :: Maybe (Map.Map Text AggregatedCostCentre)+ -> Map.Map Text AggregatedCostCentre updateCostCentre = \case Nothing -> Map.singleton (costCentreName node) aggregate Just costCentreByName ->@@ -304,19 +304,19 @@ aggregate costCentreByName addCostCentre x y = x- { aggregateCostCentreEntries = seqM $ (+)- <$> aggregateCostCentreEntries x- <*> aggregateCostCentreEntries y- , aggregateCostCentreTime =- aggregateCostCentreTime x + aggregateCostCentreTime y- , aggregateCostCentreAlloc =- aggregateCostCentreAlloc x + aggregateCostCentreAlloc y- , aggregateCostCentreTicks = seqM $ (+)- <$> aggregateCostCentreTicks x- <*> aggregateCostCentreTicks y- , aggregateCostCentreBytes = seqM $ (+)- <$> aggregateCostCentreBytes x- <*> aggregateCostCentreBytes y+ { aggregatedCostCentreEntries = seqM $ (+)+ <$> aggregatedCostCentreEntries x+ <*> aggregatedCostCentreEntries y+ , aggregatedCostCentreTime =+ aggregatedCostCentreTime x + aggregatedCostCentreTime y+ , aggregatedCostCentreAlloc =+ aggregatedCostCentreAlloc x + aggregatedCostCentreAlloc y+ , aggregatedCostCentreTicks = seqM $ (+)+ <$> aggregatedCostCentreTicks x+ <*> aggregatedCostCentreTicks y+ , aggregatedCostCentreBytes = seqM $ (+)+ <$> aggregatedCostCentreBytes x+ <*> aggregatedCostCentreBytes y } howMany :: Parser a -> Parser Int
src/GHC/Prof/Types.hs view
@@ -16,7 +16,7 @@ , profileCommandLine :: !Text , profileTotalTime :: !TotalTime , profileTotalAlloc :: !TotalAlloc- , profileTopCostCentres :: [AggregateCostCentre]+ , profileTopCostCentres :: [AggregatedCostCentre] , profileCostCentreTree :: !CostCentreTree } deriving Show @@ -38,23 +38,23 @@ -- ^ Total memory allocation in bytes } deriving Show -data AggregateCostCentre = AggregateCostCentre- { aggregateCostCentreName :: !Text+data AggregatedCostCentre = AggregatedCostCentre+ { aggregatedCostCentreName :: !Text -- ^ Name of the cost-centre- , aggregateCostCentreModule :: !Text+ , aggregatedCostCentreModule :: !Text -- ^ Module name of the cost-centre- , aggregateCostCentreSrc :: !(Maybe Text)+ , aggregatedCostCentreSrc :: !(Maybe Text) -- ^ Source location of the cost-centre- , aggregateCostCentreEntries :: !(Maybe Integer)+ , aggregatedCostCentreEntries :: !(Maybe Integer) -- ^ Number of entries to the cost-centre- , aggregateCostCentreTime :: !Scientific+ , aggregatedCostCentreTime :: !Scientific -- ^ Total time spent in the cost-centre- , aggregateCostCentreAlloc :: !Scientific+ , aggregatedCostCentreAlloc :: !Scientific -- ^ Total allocation in the cost-centre- , aggregateCostCentreTicks :: !(Maybe Integer)+ , aggregatedCostCentreTicks :: !(Maybe Integer) -- ^ Total ticks in the cost-centre. This number exists only if -- @-P@ or @-Pa@ option is given at run-time.- , aggregateCostCentreBytes :: !(Maybe Integer)+ , aggregatedCostCentreBytes :: !(Maybe Integer) -- ^ Total memory allocation in the cost-centre. This number -- exists only if @-P@ or @-Pa@ option is given at run-time. } deriving (Show, Eq, Ord)@@ -92,7 +92,7 @@ , costCentreParents :: !(IntMap CostCentreNo) , costCentreChildren :: !(IntMap (Set CostCentre)) , costCentreCallSites :: !(Map (Text, Text) (Set CostCentre))- , costCentreAggregate :: !(Map Text (Map Text AggregateCostCentre))+ , costCentreAggregate :: !(Map Text (Map Text AggregatedCostCentre)) } deriving Show emptyCostCentreTree :: CostCentreTree
tests/Regression.hs view
@@ -62,36 +62,36 @@ text <- TL.readFile path case ATL.parse profile text of ATL.Done _ prof -> do- let actual = Set.fromList $ map Similar $ aggregateCostCentres prof+ let actual = Set.fromList $ map Similar $ aggregatedCostCentres prof expected = Set.fromList $ map Similar $ profileTopCostCentres prof assertBool ("Missing cost centre(s): " ++ show (Set.difference expected actual)) $ Set.isSubsetOf expected actual ATL.Fail _ _ reason -> assertFailure reason -newtype Similar = Similar AggregateCostCentre+newtype Similar = Similar AggregatedCostCentre instance Show Similar where show (Similar a) = show a instance Eq Similar where Similar a == Similar b =- aggregateCostCentreName a == aggregateCostCentreName b- && aggregateCostCentreModule a == aggregateCostCentreModule b- && aggregateCostCentreTime a == aggregateCostCentreTime b- && aggregateCostCentreAlloc a == aggregateCostCentreAlloc b- && aggregateCostCentreTicks a == aggregateCostCentreTicks b- && aggregateCostCentreBytes a == aggregateCostCentreBytes b+ aggregatedCostCentreName a == aggregatedCostCentreName b+ && aggregatedCostCentreModule a == aggregatedCostCentreModule b+ && aggregatedCostCentreTime a == aggregatedCostCentreTime b+ && aggregatedCostCentreAlloc a == aggregatedCostCentreAlloc b+ && aggregatedCostCentreTicks a == aggregatedCostCentreTicks b+ && aggregatedCostCentreBytes a == aggregatedCostCentreBytes b instance Ord Similar where compare (Similar a) (Similar b) =- compare (aggregateCostCentreName a) (aggregateCostCentreName b)- <> compare (aggregateCostCentreModule a) (aggregateCostCentreModule b)- <> compare (aggregateCostCentreTime a) (aggregateCostCentreTime b)- <> compare (aggregateCostCentreAlloc a) (aggregateCostCentreAlloc b)- <> compare (aggregateCostCentreTicks a) (aggregateCostCentreTicks b)- <> compare (aggregateCostCentreBytes a) (aggregateCostCentreBytes b)+ compare (aggregatedCostCentreName a) (aggregatedCostCentreName b)+ <> compare (aggregatedCostCentreModule a) (aggregatedCostCentreModule b)+ <> compare (aggregatedCostCentreTime a) (aggregatedCostCentreTime b)+ <> compare (aggregatedCostCentreAlloc a) (aggregatedCostCentreAlloc b)+ <> compare (aggregatedCostCentreTicks a) (aggregatedCostCentreTicks b)+ <> compare (aggregatedCostCentreBytes a) (aggregatedCostCentreBytes b) #if !MIN_VERSION_directory(1, 2, 3) withCurrentDirectory :: FilePath -> IO a -> IO a