| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Rts.Cgroup
Description
Linux cgroup v2 limits and memory observations, independent of GHC runtime planning.
Synopsis
- data CgroupLimits = CgroupLimits {}
- readCgroupLimits :: IO CgroupLimits
- parseCpuMax :: Text -> Maybe Double
- parseMemoryMax :: Text -> Maybe Int
- parseInactiveFile :: Text -> Maybe Int
- readIfExists :: FilePath -> IO (Maybe Text)
- usePermille :: Int -> Maybe Int -> Int -> Int
- cgroupMemoryUse :: IO (IO (Maybe Int))
Documentation
data CgroupLimits Source #
The cgroup v2 grant per axis: CPU quota in cores, memory.max in bytes, Nothing when absent or max.
Constructors
| CgroupLimits | |
Fields | |
Instances
| Show CgroupLimits Source # | |
Defined in Ecluse.Rts.Cgroup Methods showsPrec :: Int -> CgroupLimits -> ShowS # show :: CgroupLimits -> String # showList :: [CgroupLimits] -> ShowS # | |
| Eq CgroupLimits Source # | |
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.