ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Rts.Cgroup

Description

Linux cgroup v2 limits and memory observations, independent of GHC runtime planning.

Synopsis

Documentation

data CgroupLimits Source #

The cgroup v2 grant per axis: CPU quota in cores, memory.max in bytes, Nothing when absent or max.

Instances

Instances details
Show CgroupLimits Source # 
Instance details

Defined in Ecluse.Rts.Cgroup

Eq CgroupLimits Source # 
Instance details

Defined in Ecluse.Rts.Cgroup

readCgroupLimits :: IO CgroupLimits Source #

Read the tightest CPU and memory limits across the process cgroup and its ancestors.

parseCpuMax :: Text -> Maybe Double Source #

Parse a cgroup v2 cpu.max body into granted cores. The max sentinel or a malformed body yields Nothing.

parseMemoryMax :: Text -> Maybe Int Source #

Parse a cgroup v2 memory.max body into bytes. The max sentinel or a malformed body yields Nothing.

parseInactiveFile :: Text -> Maybe Int Source #

The inactive_file bytes in a cgroup-v2 memory.stat body: page cache the kernel reclaims first.

readIfExists :: FilePath -> IO (Maybe Text) Source #

Read a file that may be absent, as off a cgroup-v2 host. Every other IO error propagates.

usePermille :: Int -> Maybe Int -> Int -> Int Source #

Memory in use less reclaimable page cache, in thousandths of the limit, from a cgroup's readings.

cgroupMemoryUse :: IO (IO (Maybe Int)) Source #

A reader for cgroup memory use less inactive file pages, in thousandths of the tightest memory.max, else Nothing.