    {-# LANGUAGE DeriveGeneric #-}

    module GHC.Exts.Heap.ProfInfo.Types where

    import Prelude
    import Data.Word
    import GHC.Generics

    -- | This is a somewhat faithful representation of StgTSOProfInfo. See
    -- <https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/storage/TSO.h>
    -- for more details on this data structure.
    newtype StgTSOProfInfo = StgTSOProfInfo {
        StgTSOProfInfo -> Maybe CostCentreStack
    cccs :: Maybe CostCentreStack
    } deriving (Int -> StgTSOProfInfo -> ShowS
    [StgTSOProfInfo] -> ShowS
    StgTSOProfInfo -> String
    (Int -> StgTSOProfInfo -> ShowS)
    -> (StgTSOProfInfo -> String)
    -> ([StgTSOProfInfo] -> ShowS)
    -> Show StgTSOProfInfo
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> StgTSOProfInfo -> ShowS
    showsPrec :: Int -> StgTSOProfInfo -> ShowS
    $cshow :: StgTSOProfInfo -> String
    show :: StgTSOProfInfo -> String
    $cshowList :: [StgTSOProfInfo] -> ShowS
    showList :: [StgTSOProfInfo] -> ShowS
    Show, (forall x. StgTSOProfInfo -> Rep StgTSOProfInfo x)
    -> (forall x. Rep StgTSOProfInfo x -> StgTSOProfInfo)
    -> Generic StgTSOProfInfo
    forall x. Rep StgTSOProfInfo x -> StgTSOProfInfo
    forall x. StgTSOProfInfo -> Rep StgTSOProfInfo x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. StgTSOProfInfo -> Rep StgTSOProfInfo x
    from :: forall x. StgTSOProfInfo -> Rep StgTSOProfInfo x
    $cto :: forall x. Rep StgTSOProfInfo x -> StgTSOProfInfo
    to :: forall x. Rep StgTSOProfInfo x -> StgTSOProfInfo
    Generic, StgTSOProfInfo -> StgTSOProfInfo -> Bool
    (StgTSOProfInfo -> StgTSOProfInfo -> Bool)
    -> (StgTSOProfInfo -> StgTSOProfInfo -> Bool) -> Eq StgTSOProfInfo
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    == :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    $c/= :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    /= :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    Eq, Eq StgTSOProfInfo
    Eq StgTSOProfInfo
    -> (StgTSOProfInfo -> StgTSOProfInfo -> Ordering)
    -> (StgTSOProfInfo -> StgTSOProfInfo -> Bool)
    -> (StgTSOProfInfo -> StgTSOProfInfo -> Bool)
    -> (StgTSOProfInfo -> StgTSOProfInfo -> Bool)
    -> (StgTSOProfInfo -> StgTSOProfInfo -> Bool)
    -> (StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo)
    -> (StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo)
    -> Ord StgTSOProfInfo
    StgTSOProfInfo -> StgTSOProfInfo -> Bool
    StgTSOProfInfo -> StgTSOProfInfo -> Ordering
    StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo
    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
    $ccompare :: StgTSOProfInfo -> StgTSOProfInfo -> Ordering
    compare :: StgTSOProfInfo -> StgTSOProfInfo -> Ordering
    $c< :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    < :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    $c<= :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    <= :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    $c> :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    > :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    $c>= :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    >= :: StgTSOProfInfo -> StgTSOProfInfo -> Bool
    $cmax :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo
    max :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo
    $cmin :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo
    min :: StgTSOProfInfo -> StgTSOProfInfo -> StgTSOProfInfo
    Ord)

    -- | This is a somewhat faithful representation of CostCentreStack. See
    -- <https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h>
    -- for more details on this data structure.
    data CostCentreStack = CostCentreStack {
        CostCentreStack -> Int
    ccs_ccsID :: Int,
        CostCentreStack -> CostCentre
    ccs_cc :: CostCentre,
        CostCentreStack -> Maybe CostCentreStack
    ccs_prevStack :: Maybe CostCentreStack,
        CostCentreStack -> Maybe IndexTable
    ccs_indexTable :: Maybe IndexTable,
        CostCentreStack -> Maybe CostCentreStack
    ccs_root :: Maybe CostCentreStack,
        CostCentreStack -> Word
    ccs_depth :: Word,
        CostCentreStack -> Word64
    ccs_scc_count :: Word64,
        CostCentreStack -> Word
    ccs_selected :: Word,
        CostCentreStack -> Word
    ccs_time_ticks :: Word,
        CostCentreStack -> Word64
    ccs_mem_alloc :: Word64,
        CostCentreStack -> Word64
    ccs_inherited_alloc :: Word64,
        CostCentreStack -> Word
    ccs_inherited_ticks :: Word
    } deriving (Int -> CostCentreStack -> ShowS
    [CostCentreStack] -> ShowS
    CostCentreStack -> String
    (Int -> CostCentreStack -> ShowS)
    -> (CostCentreStack -> String)
    -> ([CostCentreStack] -> ShowS)
    -> Show CostCentreStack
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CostCentreStack -> ShowS
    showsPrec :: Int -> CostCentreStack -> ShowS
    $cshow :: CostCentreStack -> String
    show :: CostCentreStack -> String
    $cshowList :: [CostCentreStack] -> ShowS
    showList :: [CostCentreStack] -> ShowS
    Show, (forall x. CostCentreStack -> Rep CostCentreStack x)
    -> (forall x. Rep CostCentreStack x -> CostCentreStack)
    -> Generic CostCentreStack
    forall x. Rep CostCentreStack x -> CostCentreStack
    forall x. CostCentreStack -> Rep CostCentreStack x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. CostCentreStack -> Rep CostCentreStack x
    from :: forall x. CostCentreStack -> Rep CostCentreStack x
    $cto :: forall x. Rep CostCentreStack x -> CostCentreStack
    to :: forall x. Rep CostCentreStack x -> CostCentreStack
    Generic, CostCentreStack -> CostCentreStack -> Bool
    (CostCentreStack -> CostCentreStack -> Bool)
    -> (CostCentreStack -> CostCentreStack -> Bool)
    -> Eq CostCentreStack
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: CostCentreStack -> CostCentreStack -> Bool
    == :: CostCentreStack -> CostCentreStack -> Bool
    $c/= :: CostCentreStack -> CostCentreStack -> Bool
    /= :: CostCentreStack -> CostCentreStack -> Bool
    Eq, Eq CostCentreStack
    Eq CostCentreStack
    -> (CostCentreStack -> CostCentreStack -> Ordering)
    -> (CostCentreStack -> CostCentreStack -> Bool)
    -> (CostCentreStack -> CostCentreStack -> Bool)
    -> (CostCentreStack -> CostCentreStack -> Bool)
    -> (CostCentreStack -> CostCentreStack -> Bool)
    -> (CostCentreStack -> CostCentreStack -> CostCentreStack)
    -> (CostCentreStack -> CostCentreStack -> CostCentreStack)
    -> Ord CostCentreStack
    CostCentreStack -> CostCentreStack -> Bool
    CostCentreStack -> CostCentreStack -> Ordering
    CostCentreStack -> CostCentreStack -> CostCentreStack
    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
    $ccompare :: CostCentreStack -> CostCentreStack -> Ordering
    compare :: CostCentreStack -> CostCentreStack -> Ordering
    $c< :: CostCentreStack -> CostCentreStack -> Bool
    < :: CostCentreStack -> CostCentreStack -> Bool
    $c<= :: CostCentreStack -> CostCentreStack -> Bool
    <= :: CostCentreStack -> CostCentreStack -> Bool
    $c> :: CostCentreStack -> CostCentreStack -> Bool
    > :: CostCentreStack -> CostCentreStack -> Bool
    $c>= :: CostCentreStack -> CostCentreStack -> Bool
    >= :: CostCentreStack -> CostCentreStack -> Bool
    $cmax :: CostCentreStack -> CostCentreStack -> CostCentreStack
    max :: CostCentreStack -> CostCentreStack -> CostCentreStack
    $cmin :: CostCentreStack -> CostCentreStack -> CostCentreStack
    min :: CostCentreStack -> CostCentreStack -> CostCentreStack
    Ord)

    -- | This is a somewhat faithful representation of CostCentre. See
    -- <https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h>
    -- for more details on this data structure.
    data CostCentre = CostCentre {
        CostCentre -> Int
    cc_ccID :: Int,
        CostCentre -> String
    cc_label :: String,
        CostCentre -> String
    cc_module :: String,
        CostCentre -> Maybe String
    cc_srcloc :: Maybe String,
        CostCentre -> Word64
    cc_mem_alloc :: Word64,
        CostCentre -> Word
    cc_time_ticks :: Word,
        CostCentre -> Bool
    cc_is_caf :: Bool,
        CostCentre -> Maybe CostCentre
    cc_link :: Maybe CostCentre
    } deriving (Int -> CostCentre -> ShowS
    [CostCentre] -> ShowS
    CostCentre -> String
    (Int -> CostCentre -> ShowS)
    -> (CostCentre -> String)
    -> ([CostCentre] -> ShowS)
    -> Show CostCentre
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> CostCentre -> ShowS
    showsPrec :: Int -> CostCentre -> ShowS
    $cshow :: CostCentre -> String
    show :: CostCentre -> String
    $cshowList :: [CostCentre] -> ShowS
    showList :: [CostCentre] -> ShowS
    Show, (forall x. CostCentre -> Rep CostCentre x)
    -> (forall x. Rep CostCentre x -> CostCentre) -> Generic CostCentre
    forall x. Rep CostCentre x -> CostCentre
    forall x. CostCentre -> Rep CostCentre x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. CostCentre -> Rep CostCentre x
    from :: forall x. CostCentre -> Rep CostCentre x
    $cto :: forall x. Rep CostCentre x -> CostCentre
    to :: forall x. Rep CostCentre x -> CostCentre
    Generic, CostCentre -> CostCentre -> Bool
    (CostCentre -> CostCentre -> Bool)
    -> (CostCentre -> CostCentre -> Bool) -> Eq CostCentre
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: CostCentre -> CostCentre -> Bool
    == :: CostCentre -> CostCentre -> Bool
    $c/= :: CostCentre -> CostCentre -> Bool
    /= :: CostCentre -> CostCentre -> Bool
    Eq, Eq CostCentre
    Eq CostCentre
    -> (CostCentre -> CostCentre -> Ordering)
    -> (CostCentre -> CostCentre -> Bool)
    -> (CostCentre -> CostCentre -> Bool)
    -> (CostCentre -> CostCentre -> Bool)
    -> (CostCentre -> CostCentre -> Bool)
    -> (CostCentre -> CostCentre -> CostCentre)
    -> (CostCentre -> CostCentre -> CostCentre)
    -> Ord 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
    $ccompare :: CostCentre -> CostCentre -> Ordering
    compare :: CostCentre -> CostCentre -> Ordering
    $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
    >= :: CostCentre -> CostCentre -> Bool
    $cmax :: CostCentre -> CostCentre -> CostCentre
    max :: CostCentre -> CostCentre -> CostCentre
    $cmin :: CostCentre -> CostCentre -> CostCentre
    min :: CostCentre -> CostCentre -> CostCentre
    Ord)

    -- | This is a somewhat faithful representation of IndexTable. See
    -- <https://gitlab.haskell.org/ghc/ghc/blob/master/rts/include/rts/prof/CCS.h>
    -- for more details on this data structure.
    data IndexTable = IndexTable {
        IndexTable -> CostCentre
    it_cc :: CostCentre,
        IndexTable -> Maybe CostCentreStack
    it_ccs :: Maybe CostCentreStack,
        IndexTable -> Maybe IndexTable
    it_next :: Maybe IndexTable,
        IndexTable -> Bool
    it_back_edge :: Bool
    } deriving (Int -> IndexTable -> ShowS
    [IndexTable] -> ShowS
    IndexTable -> String
    (Int -> IndexTable -> ShowS)
    -> (IndexTable -> String)
    -> ([IndexTable] -> ShowS)
    -> Show IndexTable
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> IndexTable -> ShowS
    showsPrec :: Int -> IndexTable -> ShowS
    $cshow :: IndexTable -> String
    show :: IndexTable -> String
    $cshowList :: [IndexTable] -> ShowS
    showList :: [IndexTable] -> ShowS
    Show, (forall x. IndexTable -> Rep IndexTable x)
    -> (forall x. Rep IndexTable x -> IndexTable) -> Generic IndexTable
    forall x. Rep IndexTable x -> IndexTable
    forall x. IndexTable -> Rep IndexTable x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. IndexTable -> Rep IndexTable x
    from :: forall x. IndexTable -> Rep IndexTable x
    $cto :: forall x. Rep IndexTable x -> IndexTable
    to :: forall x. Rep IndexTable x -> IndexTable
    Generic, IndexTable -> IndexTable -> Bool
    (IndexTable -> IndexTable -> Bool)
    -> (IndexTable -> IndexTable -> Bool) -> Eq IndexTable
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: IndexTable -> IndexTable -> Bool
    == :: IndexTable -> IndexTable -> Bool
    $c/= :: IndexTable -> IndexTable -> Bool
    /= :: IndexTable -> IndexTable -> Bool
    Eq, Eq IndexTable
    Eq IndexTable
    -> (IndexTable -> IndexTable -> Ordering)
    -> (IndexTable -> IndexTable -> Bool)
    -> (IndexTable -> IndexTable -> Bool)
    -> (IndexTable -> IndexTable -> Bool)
    -> (IndexTable -> IndexTable -> Bool)
    -> (IndexTable -> IndexTable -> IndexTable)
    -> (IndexTable -> IndexTable -> IndexTable)
    -> Ord IndexTable
    IndexTable -> IndexTable -> Bool
    IndexTable -> IndexTable -> Ordering
    IndexTable -> IndexTable -> IndexTable
    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
    $ccompare :: IndexTable -> IndexTable -> Ordering
    compare :: IndexTable -> IndexTable -> Ordering
    $c< :: IndexTable -> IndexTable -> Bool
    < :: IndexTable -> IndexTable -> Bool
    $c<= :: IndexTable -> IndexTable -> Bool
    <= :: IndexTable -> IndexTable -> Bool
    $c> :: IndexTable -> IndexTable -> Bool
    > :: IndexTable -> IndexTable -> Bool
    $c>= :: IndexTable -> IndexTable -> Bool
    >= :: IndexTable -> IndexTable -> Bool
    $cmax :: IndexTable -> IndexTable -> IndexTable
    max :: IndexTable -> IndexTable -> IndexTable
    $cmin :: IndexTable -> IndexTable -> IndexTable
    min :: IndexTable -> IndexTable -> IndexTable
    Ord)