Module: Process::Metrics::Host::Memory::Linux
- Defined in:
- lib/process/metrics/host/memory/linux.rb
Overview
Linux host memory: tries cgroup v2, then cgroup v1, then /proc/meminfo.
Defined Under Namespace
Classes: CgroupV1, CgroupV2, Meminfo
Constant Summary collapse
- DEFAULT_CGROUP_ROOT =
"/sys/fs/cgroup"
Class Method Summary collapse
Class Method Details
.capture(cgroup_root: DEFAULT_CGROUP_ROOT) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/process/metrics/host/memory/linux.rb', line 13 def self.capture(cgroup_root: DEFAULT_CGROUP_ROOT) if Memory::Linux::CgroupV2.supported?(cgroup_root) if capture = Memory::Linux::CgroupV2.new(cgroup_root: cgroup_root).capture return capture end end if Memory::Linux::CgroupV1.supported?(cgroup_root) if capture = Memory::Linux::CgroupV1.new(cgroup_root: cgroup_root).capture return capture end end return Memory::Linux::Meminfo.new.capture if Memory::Linux::Meminfo.supported? end |