{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE Safe #-}
module GHC.Stats
(
RTSStats(..), GCDetails(..), RtsTime
, getRTSStats
, getRTSStatsEnabled
) where
import Prelude (Bool,IO,Read,Show,(<$>))
import qualified GHC.Internal.Stats as Internal
import GHC.Generics (Generic)
import Data.Word (Word64,Word32)
import Data.Int (Int64)
type RtsTime = Int64
data RTSStats = RTSStats {
RTSStats -> Word32
gcs :: Word32
, RTSStats -> Word32
major_gcs :: Word32
, RTSStats -> Word64
allocated_bytes :: Word64
, RTSStats -> Word64
max_live_bytes :: Word64
, RTSStats -> Word64
max_large_objects_bytes :: Word64
, RTSStats -> Word64
max_compact_bytes :: Word64
, RTSStats -> Word64
max_slop_bytes :: Word64
, RTSStats -> Word64
max_mem_in_use_bytes :: Word64
, RTSStats -> Word64
cumulative_live_bytes :: Word64
, RTSStats -> Word64
copied_bytes :: Word64
, RTSStats -> Word64
par_copied_bytes :: Word64
, RTSStats -> Word64
cumulative_par_max_copied_bytes :: Word64
, RTSStats -> Word64
cumulative_par_balanced_copied_bytes :: Word64
, RTSStats -> RtsTime
init_cpu_ns :: RtsTime
, RTSStats -> RtsTime
init_elapsed_ns :: RtsTime
, RTSStats -> RtsTime
mutator_cpu_ns :: RtsTime
, RTSStats -> RtsTime
mutator_elapsed_ns :: RtsTime
, RTSStats -> RtsTime
gc_cpu_ns :: RtsTime
, RTSStats -> RtsTime
gc_elapsed_ns :: RtsTime
, RTSStats -> RtsTime
cpu_ns :: RtsTime
, RTSStats -> RtsTime
elapsed_ns :: RtsTime
, RTSStats -> RtsTime
nonmoving_gc_sync_cpu_ns :: RtsTime
, RTSStats -> RtsTime
nonmoving_gc_sync_elapsed_ns :: RtsTime
, RTSStats -> RtsTime
nonmoving_gc_sync_max_elapsed_ns :: RtsTime
, RTSStats -> RtsTime
nonmoving_gc_cpu_ns :: RtsTime
, RTSStats -> RtsTime
nonmoving_gc_elapsed_ns :: RtsTime
, RTSStats -> RtsTime
nonmoving_gc_max_elapsed_ns :: RtsTime
, RTSStats -> GCDetails
gc :: GCDetails
} deriving ( ReadPrec [RTSStats]
ReadPrec RTSStats
Int -> ReadS RTSStats
ReadS [RTSStats]
(Int -> ReadS RTSStats)
-> ReadS [RTSStats]
-> ReadPrec RTSStats
-> ReadPrec [RTSStats]
-> Read RTSStats
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS RTSStats
readsPrec :: Int -> ReadS RTSStats
$creadList :: ReadS [RTSStats]
readList :: ReadS [RTSStats]
$creadPrec :: ReadPrec RTSStats
readPrec :: ReadPrec RTSStats
$creadListPrec :: ReadPrec [RTSStats]
readListPrec :: ReadPrec [RTSStats]
Read
, Int -> RTSStats -> ShowS
[RTSStats] -> ShowS
RTSStats -> String
(Int -> RTSStats -> ShowS)
-> (RTSStats -> String) -> ([RTSStats] -> ShowS) -> Show RTSStats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RTSStats -> ShowS
showsPrec :: Int -> RTSStats -> ShowS
$cshow :: RTSStats -> String
show :: RTSStats -> String
$cshowList :: [RTSStats] -> ShowS
showList :: [RTSStats] -> ShowS
Show
, (forall x. RTSStats -> Rep RTSStats x)
-> (forall x. Rep RTSStats x -> RTSStats) -> Generic RTSStats
forall x. Rep RTSStats x -> RTSStats
forall x. RTSStats -> Rep RTSStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RTSStats -> Rep RTSStats x
from :: forall x. RTSStats -> Rep RTSStats x
$cto :: forall x. Rep RTSStats x -> RTSStats
to :: forall x. Rep RTSStats x -> RTSStats
Generic
)
data GCDetails = GCDetails {
GCDetails -> Word32
gcdetails_gen :: Word32
, GCDetails -> Word32
gcdetails_threads :: Word32
, GCDetails -> Word64
gcdetails_allocated_bytes :: Word64
, GCDetails -> Word64
gcdetails_live_bytes :: Word64
, GCDetails -> Word64
gcdetails_large_objects_bytes :: Word64
, GCDetails -> Word64
gcdetails_compact_bytes :: Word64
, GCDetails -> Word64
gcdetails_slop_bytes :: Word64
, GCDetails -> Word64
gcdetails_mem_in_use_bytes :: Word64
, GCDetails -> Word64
gcdetails_copied_bytes :: Word64
, GCDetails -> Word64
gcdetails_par_max_copied_bytes :: Word64
, GCDetails -> Word64
gcdetails_par_balanced_copied_bytes :: Word64
, GCDetails -> Word64
gcdetails_block_fragmentation_bytes :: Word64
, GCDetails -> RtsTime
gcdetails_sync_elapsed_ns :: RtsTime
, GCDetails -> RtsTime
gcdetails_cpu_ns :: RtsTime
, GCDetails -> RtsTime
gcdetails_elapsed_ns :: RtsTime
, GCDetails -> RtsTime
gcdetails_nonmoving_gc_sync_cpu_ns :: RtsTime
, GCDetails -> RtsTime
gcdetails_nonmoving_gc_sync_elapsed_ns :: RtsTime
} deriving ( ReadPrec [GCDetails]
ReadPrec GCDetails
Int -> ReadS GCDetails
ReadS [GCDetails]
(Int -> ReadS GCDetails)
-> ReadS [GCDetails]
-> ReadPrec GCDetails
-> ReadPrec [GCDetails]
-> Read GCDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS GCDetails
readsPrec :: Int -> ReadS GCDetails
$creadList :: ReadS [GCDetails]
readList :: ReadS [GCDetails]
$creadPrec :: ReadPrec GCDetails
readPrec :: ReadPrec GCDetails
$creadListPrec :: ReadPrec [GCDetails]
readListPrec :: ReadPrec [GCDetails]
Read
, Int -> GCDetails -> ShowS
[GCDetails] -> ShowS
GCDetails -> String
(Int -> GCDetails -> ShowS)
-> (GCDetails -> String)
-> ([GCDetails] -> ShowS)
-> Show GCDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GCDetails -> ShowS
showsPrec :: Int -> GCDetails -> ShowS
$cshow :: GCDetails -> String
show :: GCDetails -> String
$cshowList :: [GCDetails] -> ShowS
showList :: [GCDetails] -> ShowS
Show
, (forall x. GCDetails -> Rep GCDetails x)
-> (forall x. Rep GCDetails x -> GCDetails) -> Generic GCDetails
forall x. Rep GCDetails x -> GCDetails
forall x. GCDetails -> Rep GCDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GCDetails -> Rep GCDetails x
from :: forall x. GCDetails -> Rep GCDetails x
$cto :: forall x. Rep GCDetails x -> GCDetails
to :: forall x. Rep GCDetails x -> GCDetails
Generic
)
internal_to_base_RTSStats :: Internal.RTSStats -> RTSStats
internal_to_base_RTSStats :: RTSStats -> RTSStats
internal_to_base_RTSStats i :: RTSStats
i@Internal.RTSStats{RtsTime
Word32
Word64
GCDetails
gcs :: Word32
major_gcs :: Word32
allocated_bytes :: Word64
max_live_bytes :: Word64
max_large_objects_bytes :: Word64
max_compact_bytes :: Word64
max_slop_bytes :: Word64
max_mem_in_use_bytes :: Word64
cumulative_live_bytes :: Word64
copied_bytes :: Word64
par_copied_bytes :: Word64
cumulative_par_max_copied_bytes :: Word64
cumulative_par_balanced_copied_bytes :: Word64
init_cpu_ns :: RtsTime
init_elapsed_ns :: RtsTime
mutator_cpu_ns :: RtsTime
mutator_elapsed_ns :: RtsTime
gc_cpu_ns :: RtsTime
gc_elapsed_ns :: RtsTime
cpu_ns :: RtsTime
elapsed_ns :: RtsTime
nonmoving_gc_sync_cpu_ns :: RtsTime
nonmoving_gc_sync_elapsed_ns :: RtsTime
nonmoving_gc_sync_max_elapsed_ns :: RtsTime
nonmoving_gc_cpu_ns :: RtsTime
nonmoving_gc_elapsed_ns :: RtsTime
nonmoving_gc_max_elapsed_ns :: RtsTime
gc :: GCDetails
gc :: RTSStats -> GCDetails
nonmoving_gc_max_elapsed_ns :: RTSStats -> RtsTime
nonmoving_gc_elapsed_ns :: RTSStats -> RtsTime
nonmoving_gc_cpu_ns :: RTSStats -> RtsTime
nonmoving_gc_sync_max_elapsed_ns :: RTSStats -> RtsTime
nonmoving_gc_sync_elapsed_ns :: RTSStats -> RtsTime
nonmoving_gc_sync_cpu_ns :: RTSStats -> RtsTime
elapsed_ns :: RTSStats -> RtsTime
cpu_ns :: RTSStats -> RtsTime
gc_elapsed_ns :: RTSStats -> RtsTime
gc_cpu_ns :: RTSStats -> RtsTime
mutator_elapsed_ns :: RTSStats -> RtsTime
mutator_cpu_ns :: RTSStats -> RtsTime
init_elapsed_ns :: RTSStats -> RtsTime
init_cpu_ns :: RTSStats -> RtsTime
cumulative_par_balanced_copied_bytes :: RTSStats -> Word64
cumulative_par_max_copied_bytes :: RTSStats -> Word64
par_copied_bytes :: RTSStats -> Word64
copied_bytes :: RTSStats -> Word64
cumulative_live_bytes :: RTSStats -> Word64
max_mem_in_use_bytes :: RTSStats -> Word64
max_slop_bytes :: RTSStats -> Word64
max_compact_bytes :: RTSStats -> Word64
max_large_objects_bytes :: RTSStats -> Word64
max_live_bytes :: RTSStats -> Word64
allocated_bytes :: RTSStats -> Word64
major_gcs :: RTSStats -> Word32
gcs :: RTSStats -> Word32
..} =
let gc_details :: GCDetails
gc_details = GCDetails -> GCDetails
internal_to_base_GCDetails (RTSStats -> GCDetails
Internal.gc RTSStats
i)
in RTSStats{gc :: GCDetails
gc = GCDetails
gc_details,RtsTime
Word32
Word64
gcs :: Word32
major_gcs :: Word32
allocated_bytes :: Word64
max_live_bytes :: Word64
max_large_objects_bytes :: Word64
max_compact_bytes :: Word64
max_slop_bytes :: Word64
max_mem_in_use_bytes :: Word64
cumulative_live_bytes :: Word64
copied_bytes :: Word64
par_copied_bytes :: Word64
cumulative_par_max_copied_bytes :: Word64
cumulative_par_balanced_copied_bytes :: Word64
init_cpu_ns :: RtsTime
init_elapsed_ns :: RtsTime
mutator_cpu_ns :: RtsTime
mutator_elapsed_ns :: RtsTime
gc_cpu_ns :: RtsTime
gc_elapsed_ns :: RtsTime
cpu_ns :: RtsTime
elapsed_ns :: RtsTime
nonmoving_gc_sync_cpu_ns :: RtsTime
nonmoving_gc_sync_elapsed_ns :: RtsTime
nonmoving_gc_sync_max_elapsed_ns :: RtsTime
nonmoving_gc_cpu_ns :: RtsTime
nonmoving_gc_elapsed_ns :: RtsTime
nonmoving_gc_max_elapsed_ns :: RtsTime
gcs :: Word32
major_gcs :: Word32
allocated_bytes :: Word64
max_live_bytes :: Word64
max_large_objects_bytes :: Word64
max_compact_bytes :: Word64
max_slop_bytes :: Word64
max_mem_in_use_bytes :: Word64
cumulative_live_bytes :: Word64
copied_bytes :: Word64
par_copied_bytes :: Word64
cumulative_par_max_copied_bytes :: Word64
cumulative_par_balanced_copied_bytes :: Word64
init_cpu_ns :: RtsTime
init_elapsed_ns :: RtsTime
mutator_cpu_ns :: RtsTime
mutator_elapsed_ns :: RtsTime
gc_cpu_ns :: RtsTime
gc_elapsed_ns :: RtsTime
cpu_ns :: RtsTime
elapsed_ns :: RtsTime
nonmoving_gc_sync_cpu_ns :: RtsTime
nonmoving_gc_sync_elapsed_ns :: RtsTime
nonmoving_gc_sync_max_elapsed_ns :: RtsTime
nonmoving_gc_cpu_ns :: RtsTime
nonmoving_gc_elapsed_ns :: RtsTime
nonmoving_gc_max_elapsed_ns :: RtsTime
..}
internal_to_base_GCDetails :: Internal.GCDetails -> GCDetails
internal_to_base_GCDetails :: GCDetails -> GCDetails
internal_to_base_GCDetails Internal.GCDetails{RtsTime
Word32
Word64
gcdetails_gen :: Word32
gcdetails_threads :: Word32
gcdetails_allocated_bytes :: Word64
gcdetails_live_bytes :: Word64
gcdetails_large_objects_bytes :: Word64
gcdetails_compact_bytes :: Word64
gcdetails_slop_bytes :: Word64
gcdetails_mem_in_use_bytes :: Word64
gcdetails_copied_bytes :: Word64
gcdetails_par_max_copied_bytes :: Word64
gcdetails_par_balanced_copied_bytes :: Word64
gcdetails_block_fragmentation_bytes :: Word64
gcdetails_sync_elapsed_ns :: RtsTime
gcdetails_cpu_ns :: RtsTime
gcdetails_elapsed_ns :: RtsTime
gcdetails_nonmoving_gc_sync_cpu_ns :: RtsTime
gcdetails_nonmoving_gc_sync_elapsed_ns :: RtsTime
gcdetails_nonmoving_gc_sync_elapsed_ns :: GCDetails -> RtsTime
gcdetails_nonmoving_gc_sync_cpu_ns :: GCDetails -> RtsTime
gcdetails_elapsed_ns :: GCDetails -> RtsTime
gcdetails_cpu_ns :: GCDetails -> RtsTime
gcdetails_sync_elapsed_ns :: GCDetails -> RtsTime
gcdetails_block_fragmentation_bytes :: GCDetails -> Word64
gcdetails_par_balanced_copied_bytes :: GCDetails -> Word64
gcdetails_par_max_copied_bytes :: GCDetails -> Word64
gcdetails_copied_bytes :: GCDetails -> Word64
gcdetails_mem_in_use_bytes :: GCDetails -> Word64
gcdetails_slop_bytes :: GCDetails -> Word64
gcdetails_compact_bytes :: GCDetails -> Word64
gcdetails_large_objects_bytes :: GCDetails -> Word64
gcdetails_live_bytes :: GCDetails -> Word64
gcdetails_allocated_bytes :: GCDetails -> Word64
gcdetails_threads :: GCDetails -> Word32
gcdetails_gen :: GCDetails -> Word32
..} = GCDetails{RtsTime
Word32
Word64
gcdetails_gen :: Word32
gcdetails_threads :: Word32
gcdetails_allocated_bytes :: Word64
gcdetails_live_bytes :: Word64
gcdetails_large_objects_bytes :: Word64
gcdetails_compact_bytes :: Word64
gcdetails_slop_bytes :: Word64
gcdetails_mem_in_use_bytes :: Word64
gcdetails_copied_bytes :: Word64
gcdetails_par_max_copied_bytes :: Word64
gcdetails_par_balanced_copied_bytes :: Word64
gcdetails_block_fragmentation_bytes :: Word64
gcdetails_sync_elapsed_ns :: RtsTime
gcdetails_cpu_ns :: RtsTime
gcdetails_elapsed_ns :: RtsTime
gcdetails_nonmoving_gc_sync_cpu_ns :: RtsTime
gcdetails_nonmoving_gc_sync_elapsed_ns :: RtsTime
gcdetails_gen :: Word32
gcdetails_threads :: Word32
gcdetails_allocated_bytes :: Word64
gcdetails_live_bytes :: Word64
gcdetails_large_objects_bytes :: Word64
gcdetails_compact_bytes :: Word64
gcdetails_slop_bytes :: Word64
gcdetails_mem_in_use_bytes :: Word64
gcdetails_copied_bytes :: Word64
gcdetails_par_max_copied_bytes :: Word64
gcdetails_par_balanced_copied_bytes :: Word64
gcdetails_block_fragmentation_bytes :: Word64
gcdetails_sync_elapsed_ns :: RtsTime
gcdetails_cpu_ns :: RtsTime
gcdetails_elapsed_ns :: RtsTime
gcdetails_nonmoving_gc_sync_cpu_ns :: RtsTime
gcdetails_nonmoving_gc_sync_elapsed_ns :: RtsTime
..}
getRTSStats :: IO RTSStats
getRTSStats :: IO RTSStats
getRTSStats = RTSStats -> RTSStats
internal_to_base_RTSStats (RTSStats -> RTSStats) -> IO RTSStats -> IO RTSStats
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO RTSStats
Internal.getRTSStats
getRTSStatsEnabled :: IO Bool
getRTSStatsEnabled :: IO Bool
getRTSStatsEnabled = IO Bool
Internal.getRTSStatsEnabled