planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellNone
LanguageHaskell2010

RuntimeSystem

Contents

Synopsis

Garbage collection

performGC :: IO () #

Triggers an immediate major garbage collection.

performMajorGC :: IO () #

Triggers an immediate major garbage collection.

Since: base-4.7.0.0

performMinorGC :: IO () #

Triggers an immediate minor garbage collection.

Since: base-4.7.0.0

Allocation counter and limits

setAllocationCounter :: Int64 -> IO () #

Every thread has an allocation counter that tracks how much memory has been allocated by the thread. The counter is initialized to zero, and setAllocationCounter sets the current value. The allocation counter counts *down*, so in the absence of a call to setAllocationCounter its value is the negation of the number of bytes of memory allocated by the thread.

There are two things that you can do with this counter:

Allocation accounting is accurate only to about 4Kbytes.

Since: base-4.8.0.0

getAllocationCounter :: IO Int64 #

Return the current value of the allocation counter for the current thread.

Since: base-4.8.0.0

enableAllocationLimit :: IO () #

Enables the allocation counter to be treated as a limit for the current thread. When the allocation limit is enabled, if the allocation counter counts down below zero, the thread will be sent the AllocationLimitExceeded asynchronous exception. When this happens, the counter is reinitialised (by default to 100K, but tunable with the +RTS -xq option) so that it can handle the exception and perform any necessary clean up. If it exhausts this additional allowance, another AllocationLimitExceeded exception is sent, and so forth. Like other asynchronous exceptions, the AllocationLimitExceeded exception is deferred while the thread is inside mask or an exception handler in catch.

Note that memory allocation is unrelated to live memory, also known as heap residency. A thread can allocate a large amount of memory and retain anything between none and all of it. It is better to think of the allocation limit as a limit on CPU time, rather than a limit on memory.

Compared to using timeouts, allocation limits don't count time spent blocked or in foreign calls.

Since: base-4.8.0.0

disableAllocationLimit :: IO () #

Disable allocation limit processing for the current thread.

Since: base-4.8.0.0

Capabilities

getNumCapabilities :: IO Int #

Returns the number of Haskell threads that can run truly simultaneously (on separate physical processors) at any given time. To change this value, use setNumCapabilities.

Since: base-4.4.0.0

setNumCapabilities :: Int -> IO () #

Set the number of Haskell threads that can run truly simultaneously (on separate physical processors) at any given time. The number passed to forkOn is interpreted modulo this value. The initial value is given by the +RTS -N runtime flag.

This is also the number of threads that will participate in parallel garbage collection. It is strongly recommended that the number of capabilities is not set larger than the number of physical processor cores, and it may often be beneficial to leave one or more cores free to avoid contention with other processes in the machine.

Since: base-4.5.0.0

Spark pool

numSparks :: IO Int #

Returns the number of sparks currently in the local spark pool

runSparks :: IO () #

Internal function used by the RTS to run sparks.

Processors

getNumProcessors :: IO Int #

Returns the number of CPUs that the machine has

Since: base-4.5.0.0

Uncaught exception handler

Event manager

data EventManager #

The event manager state.

getSystemEventManager :: IO (Maybe EventManager) #

Retrieve the system event manager for the capability on which the calling thread is running.

This function always returns Just the current thread's event manager when using the threaded RTS and Nothing otherwise.

new :: IO EventManager #

Create a new event manager.

data Event #

An I/O event.

Instances
Eq Event 
Instance details

Defined in GHC.Event.Internal

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Show Event

Since: base-4.3.1.0

Instance details

Defined in GHC.Event.Internal

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

Semigroup Event

Since: base-4.10.0.0

Instance details

Defined in GHC.Event.Internal

Methods

(<>) :: Event -> Event -> Event #

sconcat :: NonEmpty Event -> Event #

stimes :: Integral b => b -> Event -> Event #

Monoid Event

Since: base-4.3.1.0

Instance details

Defined in GHC.Event.Internal

Methods

mempty :: Event #

mappend :: Event -> Event -> Event #

mconcat :: [Event] -> Event #

AsEmpty Event 
Instance details

Defined in Control.Lens.Empty

Methods

_Empty :: Prism' Event () #

evtRead :: Event #

Data is available to be read.

evtWrite :: Event #

The file descriptor is ready to accept a write.

type IOCallback = FdKey -> Event -> IO () #

Callback invoked on I/O events.

data FdKey #

A file descriptor registration cookie.

Instances
Eq FdKey 
Instance details

Defined in GHC.Event.Manager

Methods

(==) :: FdKey -> FdKey -> Bool #

(/=) :: FdKey -> FdKey -> Bool #

Show FdKey 
Instance details

Defined in GHC.Event.Manager

Methods

showsPrec :: Int -> FdKey -> ShowS #

show :: FdKey -> String #

showList :: [FdKey] -> ShowS #

data Lifetime #

The lifetime of an event registration.

Since: base-4.8.1.0

Instances
Eq Lifetime 
Instance details

Defined in GHC.Event.Internal

Show Lifetime 
Instance details

Defined in GHC.Event.Internal

Semigroup Lifetime

Since: base-4.10.0.0

Instance details

Defined in GHC.Event.Internal

Monoid Lifetime

mappend takes the longer of two lifetimes.

Since: base-4.8.0.0

Instance details

Defined in GHC.Event.Internal

registerFd :: EventManager -> IOCallback -> Fd -> Event -> Lifetime -> IO FdKey #

registerFd mgr cb fd evs lt registers interest in the events evs on the file descriptor fd for lifetime lt. cb is called for each event that occurs. Returns a cookie that can be handed to unregisterFd.

unregisterFd :: EventManager -> FdKey -> IO () #

Drop a previous file descriptor registration.

unregisterFd_ :: EventManager -> FdKey -> IO Bool #

Drop a previous file descriptor registration, without waking the event manager thread. The return value indicates whether the event manager ought to be woken.

closeFd :: EventManager -> (Fd -> IO ()) -> Fd -> IO () #

Close a file descriptor in a race-safe way.

Timer manager

data TimerManager #

The event manager state.

type TimeoutCallback = IO () #

Callback invoked on timeout events.

data TimeoutKey #

A timeout registration cookie.

Instances
Eq TimeoutKey 
Instance details

Defined in GHC.Event.TimerManager

registerTimeout :: TimerManager -> Int -> TimeoutCallback -> IO TimeoutKey #

Register a timeout in the given number of microseconds. The returned TimeoutKey can be used to later unregister or update the timeout. The timeout is automatically unregistered after the given time has passed.

updateTimeout :: TimerManager -> TimeoutKey -> Int -> IO () #

Update an active timeout to fire in the given number of microseconds.

unregisterTimeout :: TimerManager -> TimeoutKey -> IO () #

Unregister an active timeout.

Runtime stats

data RTSStats #

Statistics about runtime activity since the start of the program. This is a mirror of the C struct RTSStats in RtsAPI.h

Since: base-4.10.0.0

Constructors

RTSStats 

Fields

Instances
Read RTSStats 
Instance details

Defined in GHC.Stats

Show RTSStats 
Instance details

Defined in GHC.Stats

data GCDetails #

Statistics about a single GC. This is a mirror of the C struct GCDetails in RtsAPI.h, with the field prefixed with gc_ to avoid collisions with RTSStats.

Constructors

GCDetails 

Fields

Instances
Read GCDetails 
Instance details

Defined in GHC.Stats

Show GCDetails 
Instance details

Defined in GHC.Stats

type RtsTime = Int64 #

Time values from the RTS, using a fixed resolution of nanoseconds.

getRTSStats :: IO RTSStats #

Get current runtime system statistics.

Since: base-4.10.0.0

getRTSStatsEnabled :: IO Bool #

Returns whether GC stats have been enabled (with +RTS -T, for example).

Since: base-4.10.0.0

Memory barriers

storeLoadBarrier :: IO () #

Memory barrier implemented by the GHC rts (see SMP.h). storeLoadBarrier :: IO ()

Memory barrier implemented by the GHC rts (see SMP.h). loadLoadBarrier :: IO ()

Memory barrier implemented by the GHC rts (see SMP.h). writeBarrier :: IO ()

Memory barrier implemented by the GHC rts (see SMP.h).

loadLoadBarrier :: IO () #

Memory barrier implemented by the GHC rts (see SMP.h).

writeBarrier :: IO () #

Memory barrier implemented by the GHC rts (see SMP.h).