Available on Linux only.
Expand description
Linux cgroup detection utilities.
Structsยง
- Cgroup
Entry - An entry in /proc/self/cgroup
- Memory
Limit - Represents a cgroup memory limit, with both ram and swap maximums if they exist. Fields should be None if a limit does not exist or when running on a platform without cgroup support (ie: non-Linux platforms).
- Mountinfo
- An entry in /proc/self/mountinfo
Functionsยง
- detect_
memory_ limit - Returns the cgroup (v1 or v2) memory limit if it exists.
- parse_
proc_ self_ cgroup - Parses /proc/self/cgroup into a
Vec<CgroupEntry>, if the file exists. - parse_
proc_ self_ mountinfo - Parses /proc/self/mountinfo into vectors of Mountinfo objects, returning (v2_mounts, v1_mounts).
- read_
file_ ๐to_ usize - read_
v1_ ๐memory_ limit - Finds the cgroup v1 and mountpoint combination containing the memory controller, and reads the memory limits within.
- read_
v2_ ๐memory_ limit - Finds the mountpoint corresponding to the provided cgroup v2, and reads the memory limits within.