{-# LANGUAGE RecordWildCards #-}
module GHC.Prof.Types where
import Data.Monoid
import Prelude
import Data.IntMap (IntMap)
import Data.Map (Map)
import Data.Scientific (Scientific)
import Data.Set (Set)
import Data.Text (Text)
import Data.Time (DiffTime, LocalTime)
data Profile = Profile
{ Profile -> LocalTime
profileTimestamp :: !LocalTime
, Profile -> Text
profileCommandLine :: !Text
, Profile -> TotalTime
profileTotalTime :: !TotalTime
, Profile -> TotalAlloc
profileTotalAlloc :: !TotalAlloc
, Profile -> [AggregatedCostCentre]
profileTopCostCentres :: [AggregatedCostCentre]
, Profile -> CostCentreTree
profileCostCentreTree :: !CostCentreTree
} deriving CostCentreNo -> Profile -> ShowS
[Profile] -> ShowS
Profile -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Profile] -> ShowS
$cshowList :: [Profile] -> ShowS
show :: Profile -> String
$cshow :: Profile -> String
showsPrec :: CostCentreNo -> Profile -> ShowS
$cshowsPrec :: CostCentreNo -> Profile -> ShowS
Show
data TotalTime = TotalTime
{ TotalTime -> DiffTime
totalTimeElapsed :: !DiffTime
, TotalTime -> Integer
totalTimeTicks :: !Integer
, TotalTime -> DiffTime
totalTimeResolution :: !DiffTime
, TotalTime -> Maybe CostCentreNo
totalTimeProcessors :: !(Maybe Int)
} deriving CostCentreNo -> TotalTime -> ShowS
[TotalTime] -> ShowS
TotalTime -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TotalTime] -> ShowS
$cshowList :: [TotalTime] -> ShowS
show :: TotalTime -> String
$cshow :: TotalTime -> String
showsPrec :: CostCentreNo -> TotalTime -> ShowS
$cshowsPrec :: CostCentreNo -> TotalTime -> ShowS
Show
newtype TotalAlloc = TotalAlloc
{ TotalAlloc -> Integer
totalAllocBytes :: Integer
} deriving CostCentreNo -> TotalAlloc -> ShowS
[TotalAlloc] -> ShowS
TotalAlloc -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TotalAlloc] -> ShowS
$cshowList :: [TotalAlloc] -> ShowS
show :: TotalAlloc -> String
$cshow :: TotalAlloc -> String
showsPrec :: CostCentreNo -> TotalAlloc -> ShowS
$cshowsPrec :: CostCentreNo -> TotalAlloc -> ShowS
Show
data AggregatedCostCentre = AggregatedCostCentre
{ AggregatedCostCentre -> Text
aggregatedCostCentreName :: !Text
, AggregatedCostCentre -> Text
aggregatedCostCentreModule :: !Text
, AggregatedCostCentre -> Maybe Text
aggregatedCostCentreSrc :: !(Maybe Text)
, AggregatedCostCentre -> Maybe Integer
aggregatedCostCentreEntries :: !(Maybe Integer)
, AggregatedCostCentre -> Scientific
aggregatedCostCentreTime :: !Scientific
, AggregatedCostCentre -> Scientific
aggregatedCostCentreAlloc :: !Scientific
, AggregatedCostCentre -> Maybe Integer
aggregatedCostCentreTicks :: !(Maybe Integer)
, AggregatedCostCentre -> Maybe Integer
aggregatedCostCentreBytes :: !(Maybe Integer)
} deriving (CostCentreNo -> AggregatedCostCentre -> ShowS
[AggregatedCostCentre] -> ShowS
AggregatedCostCentre -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregatedCostCentre] -> ShowS
$cshowList :: [AggregatedCostCentre] -> ShowS
show :: AggregatedCostCentre -> String
$cshow :: AggregatedCostCentre -> String
showsPrec :: CostCentreNo -> AggregatedCostCentre -> ShowS
$cshowsPrec :: CostCentreNo -> AggregatedCostCentre -> ShowS
Show, AggregatedCostCentre -> AggregatedCostCentre -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
$c/= :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
== :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
$c== :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
Eq, Eq AggregatedCostCentre
AggregatedCostCentre -> AggregatedCostCentre -> Bool
AggregatedCostCentre -> AggregatedCostCentre -> Ordering
AggregatedCostCentre
-> AggregatedCostCentre -> AggregatedCostCentre
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AggregatedCostCentre
-> AggregatedCostCentre -> AggregatedCostCentre
$cmin :: AggregatedCostCentre
-> AggregatedCostCentre -> AggregatedCostCentre
max :: AggregatedCostCentre
-> AggregatedCostCentre -> AggregatedCostCentre
$cmax :: AggregatedCostCentre
-> AggregatedCostCentre -> AggregatedCostCentre
>= :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
$c>= :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
> :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
$c> :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
<= :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
$c<= :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
< :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
$c< :: AggregatedCostCentre -> AggregatedCostCentre -> Bool
compare :: AggregatedCostCentre -> AggregatedCostCentre -> Ordering
$ccompare :: AggregatedCostCentre -> AggregatedCostCentre -> Ordering
Ord)
data CostCentre = CostCentre
{ CostCentre -> CostCentreNo
costCentreNo :: !CostCentreNo
, CostCentre -> Text
costCentreName :: !Text
, CostCentre -> Text
costCentreModule :: !Text
, CostCentre -> Maybe Text
costCentreSrc :: !(Maybe Text)
, CostCentre -> Integer
costCentreEntries :: !Integer
, CostCentre -> Scientific
costCentreIndTime :: !Scientific
, CostCentre -> Scientific
costCentreIndAlloc :: !Scientific
, CostCentre -> Scientific
costCentreInhTime :: !Scientific
, CostCentre -> Scientific
costCentreInhAlloc :: !Scientific
, CostCentre -> Maybe Integer
costCentreTicks :: !(Maybe Integer)
, CostCentre -> Maybe Integer
costCentreBytes :: !(Maybe Integer)
} deriving (CostCentreNo -> CostCentre -> ShowS
[CostCentre] -> ShowS
CostCentre -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CostCentre] -> ShowS
$cshowList :: [CostCentre] -> ShowS
show :: CostCentre -> String
$cshow :: CostCentre -> String
showsPrec :: CostCentreNo -> CostCentre -> ShowS
$cshowsPrec :: CostCentreNo -> CostCentre -> ShowS
Show, CostCentre -> CostCentre -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CostCentre -> CostCentre -> Bool
$c/= :: CostCentre -> CostCentre -> Bool
== :: CostCentre -> CostCentre -> Bool
$c== :: CostCentre -> CostCentre -> Bool
Eq, Eq CostCentre
CostCentre -> CostCentre -> Bool
CostCentre -> CostCentre -> Ordering
CostCentre -> CostCentre -> CostCentre
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CostCentre -> CostCentre -> CostCentre
$cmin :: CostCentre -> CostCentre -> CostCentre
max :: CostCentre -> CostCentre -> CostCentre
$cmax :: CostCentre -> CostCentre -> CostCentre
>= :: CostCentre -> CostCentre -> Bool
$c>= :: CostCentre -> CostCentre -> Bool
> :: CostCentre -> CostCentre -> Bool
$c> :: CostCentre -> CostCentre -> Bool
<= :: CostCentre -> CostCentre -> Bool
$c<= :: CostCentre -> CostCentre -> Bool
< :: CostCentre -> CostCentre -> Bool
$c< :: CostCentre -> CostCentre -> Bool
compare :: CostCentre -> CostCentre -> Ordering
$ccompare :: CostCentre -> CostCentre -> Ordering
Ord)
type CostCentreNo = Int
data CostCentreTree = CostCentreTree
{ CostCentreTree -> IntMap CostCentre
costCentreNodes :: !(IntMap CostCentre)
, CostCentreTree -> IntMap CostCentreNo
costCentreParents :: !(IntMap CostCentreNo)
, CostCentreTree -> IntMap (Set CostCentre)
costCentreChildren :: !(IntMap (Set CostCentre))
, CostCentreTree -> Map (Text, Text) (Set CostCentre)
costCentreCallSites :: !(Map (Text, Text) (Set CostCentre))
, CostCentreTree -> Map Text (Map Text AggregatedCostCentre)
costCentreAggregate :: !(Map Text (Map Text AggregatedCostCentre))
} deriving CostCentreNo -> CostCentreTree -> ShowS
[CostCentreTree] -> ShowS
CostCentreTree -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CostCentreTree] -> ShowS
$cshowList :: [CostCentreTree] -> ShowS
show :: CostCentreTree -> String
$cshow :: CostCentreTree -> String
showsPrec :: CostCentreNo -> CostCentreTree -> ShowS
$cshowsPrec :: CostCentreNo -> CostCentreTree -> ShowS
Show
emptyCostCentreTree :: CostCentreTree
emptyCostCentreTree :: CostCentreTree
emptyCostCentreTree = CostCentreTree
{ costCentreNodes :: IntMap CostCentre
costCentreNodes = forall a. Monoid a => a
mempty
, costCentreParents :: IntMap CostCentreNo
costCentreParents = forall a. Monoid a => a
mempty
, costCentreChildren :: IntMap (Set CostCentre)
costCentreChildren = forall a. Monoid a => a
mempty
, costCentreCallSites :: Map (Text, Text) (Set CostCentre)
costCentreCallSites = forall a. Monoid a => a
mempty
, costCentreAggregate :: Map Text (Map Text AggregatedCostCentre)
costCentreAggregate = forall a. Monoid a => a
mempty
}
data CallSite cc = CallSite
{ forall cc. CallSite cc -> cc
callSiteCostCentre :: cc
, forall cc. CallSite cc -> Integer
callSiteContribEntries :: !Integer
, forall cc. CallSite cc -> Scientific
callSiteContribTime :: !Scientific
, forall cc. CallSite cc -> Scientific
callSiteContribAlloc :: !Scientific
, forall cc. CallSite cc -> Maybe Integer
callSiteContribTicks :: !(Maybe Integer)
, forall cc. CallSite cc -> Maybe Integer
callSiteContribBytes :: !(Maybe Integer)
} deriving CostCentreNo -> CallSite cc -> ShowS
forall cc. Show cc => CostCentreNo -> CallSite cc -> ShowS
forall cc. Show cc => [CallSite cc] -> ShowS
forall cc. Show cc => CallSite cc -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CallSite cc] -> ShowS
$cshowList :: forall cc. Show cc => [CallSite cc] -> ShowS
show :: CallSite cc -> String
$cshow :: forall cc. Show cc => CallSite cc -> String
showsPrec :: CostCentreNo -> CallSite cc -> ShowS
$cshowsPrec :: forall cc. Show cc => CostCentreNo -> CallSite cc -> ShowS
Show
data AggregateModule = AggregateModule
{ AggregateModule -> Text
aggregateModuleName :: !Text
, AggregateModule -> Maybe Integer
aggregateModuleEntries :: !(Maybe Integer)
, AggregateModule -> Scientific
aggregateModuleTime :: !Scientific
, AggregateModule -> Scientific
aggregateModuleAlloc :: !Scientific
, AggregateModule -> Maybe Integer
aggregateModuleTicks :: !(Maybe Integer)
, AggregateModule -> Maybe Integer
aggregateModuleBytes :: !(Maybe Integer)
} deriving (CostCentreNo -> AggregateModule -> ShowS
[AggregateModule] -> ShowS
AggregateModule -> String
forall a.
(CostCentreNo -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregateModule] -> ShowS
$cshowList :: [AggregateModule] -> ShowS
show :: AggregateModule -> String
$cshow :: AggregateModule -> String
showsPrec :: CostCentreNo -> AggregateModule -> ShowS
$cshowsPrec :: CostCentreNo -> AggregateModule -> ShowS
Show, AggregateModule -> AggregateModule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregateModule -> AggregateModule -> Bool
$c/= :: AggregateModule -> AggregateModule -> Bool
== :: AggregateModule -> AggregateModule -> Bool
$c== :: AggregateModule -> AggregateModule -> Bool
Eq, Eq AggregateModule
AggregateModule -> AggregateModule -> Bool
AggregateModule -> AggregateModule -> Ordering
AggregateModule -> AggregateModule -> AggregateModule
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AggregateModule -> AggregateModule -> AggregateModule
$cmin :: AggregateModule -> AggregateModule -> AggregateModule
max :: AggregateModule -> AggregateModule -> AggregateModule
$cmax :: AggregateModule -> AggregateModule -> AggregateModule
>= :: AggregateModule -> AggregateModule -> Bool
$c>= :: AggregateModule -> AggregateModule -> Bool
> :: AggregateModule -> AggregateModule -> Bool
$c> :: AggregateModule -> AggregateModule -> Bool
<= :: AggregateModule -> AggregateModule -> Bool
$c<= :: AggregateModule -> AggregateModule -> Bool
< :: AggregateModule -> AggregateModule -> Bool
$c< :: AggregateModule -> AggregateModule -> Bool
compare :: AggregateModule -> AggregateModule -> Ordering
$ccompare :: AggregateModule -> AggregateModule -> Ordering
Ord)
emptyAggregateModule :: Text -> AggregateModule
emptyAggregateModule :: Text -> AggregateModule
emptyAggregateModule Text
name = AggregateModule
{ aggregateModuleName :: Text
aggregateModuleName = Text
name
, aggregateModuleEntries :: Maybe Integer
aggregateModuleEntries = forall a. a -> Maybe a
Just Integer
0
, aggregateModuleTime :: Scientific
aggregateModuleTime = Scientific
0
, aggregateModuleAlloc :: Scientific
aggregateModuleAlloc = Scientific
0
, aggregateModuleTicks :: Maybe Integer
aggregateModuleTicks = forall a. a -> Maybe a
Just Integer
0
, aggregateModuleBytes :: Maybe Integer
aggregateModuleBytes = forall a. a -> Maybe a
Just Integer
0
}