CostCentre

ghc-8.4.0.20180118: The GHC API

Safe Haskell | None
Language | Haskell2010

CostCentre

Synopsis

- data CostCentre
  - = NormalCC {
    - cc_key :: !Int
    - cc_name :: CcName
    - cc_mod :: Module
    - cc_loc :: SrcSpan
    - cc_is_caf :: IsCafCC
    }
  - | AllCafsCC {
    - cc_mod :: Module
    - cc_loc :: SrcSpan
    }
- type CcName = FastString
- data IsCafCC
  - = NotCafCC
  - | CafCC
- data CostCentreStack
- type CollectedCCs = ([CostCentre], [CostCentre], [CostCentreStack])
- noCCS :: CostCentreStack
- currentCCS :: CostCentreStack
- dontCareCCS :: CostCentreStack
- noCCSAttached :: CostCentreStack -> Bool
- isCurrentCCS :: CostCentreStack -> Bool
- maybeSingletonCCS :: CostCentreStack -> Maybe CostCentre
- mkUserCC :: FastString -> Module -> SrcSpan -> Unique -> CostCentre
- mkAutoCC :: Id -> Module -> IsCafCC -> CostCentre
- mkAllCafsCC :: Module -> SrcSpan -> CostCentre
- mkSingletonCCS :: CostCentre -> CostCentreStack
- isCafCCS :: CostCentreStack -> Bool
- isCafCC :: CostCentre -> Bool
- isSccCountCC :: CostCentre -> Bool
- sccAbleCC :: CostCentre -> Bool
- ccFromThisModule :: CostCentre -> Module -> Bool
- pprCostCentreCore :: CostCentre -> SDoc
- costCentreUserName :: CostCentre -> String
- costCentreUserNameFS :: CostCentre -> FastString
- costCentreSrcSpan :: CostCentre -> SrcSpan
- cmpCostCentre :: CostCentre -> CostCentre -> Ordering

# Documentation

data CostCentre Source #

A Cost Centre is a single `{--}` annotation.

Constructors

NormalCC |
Fields cc_key :: !Int Two cost centres may have the same name and module but different SrcSpans, so we need a way to distinguish them easily and give them different object-code labels. So every CostCentre has a Unique that is distinct from every other CostCentre in the same module. XXX: should really be using Unique here, but we need to derive Data below and there's no Data instance for Unique. cc_name :: CcName Name of the cost centre itself cc_mod :: Module Name of module defining this CC. cc_loc :: SrcSpan cc_is_caf :: IsCafCC
AllCafsCC |
Fields cc_mod :: Module Name of module defining this CC. cc_loc :: SrcSpan

Instances

Eq CostCentre # |
Instance details Methods (==) :: CostCentre -> CostCentre -> Bool # (/=) :: CostCentre -> CostCentre -> Bool #
Data CostCentre # |
Instance details Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CostCentre -> c CostCentre Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CostCentre Source # toConstr :: CostCentre -> Constr Source # dataTypeOf :: CostCentre -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CostCentre) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CostCentre) Source # gmapT :: (forall b. Data b => b -> b) -> CostCentre -> CostCentre Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CostCentre -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CostCentre -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CostCentre -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CostCentre -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CostCentre -> m CostCentre Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CostCentre -> m CostCentre Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CostCentre -> m CostCentre Source #
Ord CostCentre # |
Instance details Methods compare :: CostCentre -> CostCentre -> Ordering # (<) :: CostCentre -> CostCentre -> Bool # (<=) :: CostCentre -> CostCentre -> Bool # (>) :: CostCentre -> CostCentre -> Bool # (>=) :: CostCentre -> CostCentre -> Bool # max :: CostCentre -> CostCentre -> CostCentre # min :: CostCentre -> CostCentre -> CostCentre #
Outputable CostCentre # |
Instance details Methods ppr :: CostCentre -> SDoc Source # pprPrec :: Rational -> CostCentre -> SDoc Source #
Binary CostCentre # |
Instance details Methods put_ :: BinHandle -> CostCentre -> IO () Source # put :: BinHandle -> CostCentre -> IO (Bin CostCentre) Source # get :: BinHandle -> IO CostCentre Source #

type CcName = FastString Source #

data IsCafCC Source #

Constructors

NotCafCC |
CafCC |

Instances

Eq IsCafCC # |
Instance details Methods (==) :: IsCafCC -> IsCafCC -> Bool # (/=) :: IsCafCC -> IsCafCC -> Bool #
Data IsCafCC # |
Instance details Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IsCafCC -> c IsCafCC Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IsCafCC Source # toConstr :: IsCafCC -> Constr Source # dataTypeOf :: IsCafCC -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IsCafCC) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsCafCC) Source # gmapT :: (forall b. Data b => b -> b) -> IsCafCC -> IsCafCC Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IsCafCC -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IsCafCC -> r Source # gmapQ :: (forall d. Data d => d -> u) -> IsCafCC -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> IsCafCC -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IsCafCC -> m IsCafCC Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IsCafCC -> m IsCafCC Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IsCafCC -> m IsCafCC Source #
Ord IsCafCC # |
Instance details Methods compare :: IsCafCC -> IsCafCC -> Ordering # (<) :: IsCafCC -> IsCafCC -> Bool # (<=) :: IsCafCC -> IsCafCC -> Bool # (>) :: IsCafCC -> IsCafCC -> Bool # (>=) :: IsCafCC -> IsCafCC -> Bool # max :: IsCafCC -> IsCafCC -> IsCafCC # min :: IsCafCC -> IsCafCC -> IsCafCC #
Binary IsCafCC # |
Instance details Methods put_ :: BinHandle -> IsCafCC -> IO () Source # put :: BinHandle -> IsCafCC -> IO (Bin IsCafCC) Source # get :: BinHandle -> IO IsCafCC Source #

data CostCentreStack Source #

A Cost Centre Stack is something that can be attached to a closure. This is either:

- the current cost centre stack (CCCS)
- a pre-defined cost centre stack (there are several pre-defined CCSs, see below).

Instances

Eq CostCentreStack # |
Instance details Methods (==) :: CostCentreStack -> CostCentreStack -> Bool # (/=) :: CostCentreStack -> CostCentreStack -> Bool #
Ord CostCentreStack # |
Instance details Methods compare :: CostCentreStack -> CostCentreStack -> Ordering # (<) :: CostCentreStack -> CostCentreStack -> Bool # (<=) :: CostCentreStack -> CostCentreStack -> Bool # (>) :: CostCentreStack -> CostCentreStack -> Bool # (>=) :: CostCentreStack -> CostCentreStack -> Bool # max :: CostCentreStack -> CostCentreStack -> CostCentreStack # min :: CostCentreStack -> CostCentreStack -> CostCentreStack #
Outputable CostCentreStack # |
Instance details Methods ppr :: CostCentreStack -> SDoc Source # pprPrec :: Rational -> CostCentreStack -> SDoc Source #

type CollectedCCs = ([CostCentre], [CostCentre], [CostCentreStack]) Source #

noCCS :: CostCentreStack Source #

currentCCS :: CostCentreStack Source #

dontCareCCS :: CostCentreStack Source #

noCCSAttached :: CostCentreStack -> Bool Source #

isCurrentCCS :: CostCentreStack -> Bool Source #

maybeSingletonCCS :: CostCentreStack -> Maybe CostCentre Source #

mkUserCC :: FastString -> Module -> SrcSpan -> Unique -> CostCentre Source #

mkAutoCC :: Id -> Module -> IsCafCC -> CostCentre Source #

mkAllCafsCC :: Module -> SrcSpan -> CostCentre Source #

mkSingletonCCS :: CostCentre -> CostCentreStack Source #

isCafCCS :: CostCentreStack -> Bool Source #

isCafCC :: CostCentre -> Bool Source #

isSccCountCC :: CostCentre -> Bool Source #

Is this a cost-centre which records scc counts

sccAbleCC :: CostCentre -> Bool Source #

Is this a cost-centre which can be sccd ?

ccFromThisModule :: CostCentre -> Module -> Bool Source #

pprCostCentreCore :: CostCentre -> SDoc Source #

costCentreUserName :: CostCentre -> String Source #

costCentreUserNameFS :: CostCentre -> FastString Source #

costCentreSrcSpan :: CostCentre -> SrcSpan Source #

cmpCostCentre :: CostCentre -> CostCentre -> Ordering Source #