cgroup-rts-threads-0.1.0.0: A container-/cgroup-aware substitute for the GHC RTS `-N` flag
Safe HaskellNone
LanguageHaskell2010

System.CGroup.CPU

Description

Types and operations for the CPU CGroup controller.

Synopsis

The CPU cgroup controller

data CPU Source #

The "cpu" cgroup controller

resolveCPUController :: IO (Controller CPU) Source #

Resolve the CPU cgroup controller for the current process

Throws an Exception if the CPU controller is not able to be found, or when running outside of a cgroup

Operations on the CPU controller

data CPUQuota Source #

A CPU quota is the amount of CPU time our process can use relative to the scheduler period

For example:

| cpu.cfs_quota_us | cpu.cfs_period_us | description |
| ---------------- | ----------------- | ----------- |
|           100000 |            100000 | (1)         |
|           200000 |            100000 | (2)         |
|            50000 |            100000 | (3)         |
|               -1 |            100000 | (4)         |
  1. : we can use up to a single CPU core
  2. : we can use up to two CPU cores
  3. : the scheduler will give us a single CPU core for up to 50% of the time
  4. : we can use all available CPU resources (there is no quota)

Constructors

NoQuota 
CPUQuota Int Int

cpu.cfs_quota_us, cpu.cfs_period_us

Instances

Instances details
Eq CPUQuota Source # 
Instance details

Defined in System.CGroup.CPU

Ord CPUQuota Source # 
Instance details

Defined in System.CGroup.CPU

Show CPUQuota Source # 
Instance details

Defined in System.CGroup.CPU

getCPUQuota :: Controller CPU -> IO CPUQuota Source #

Get the CPU quota within the given cgroup CPU controller