github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/sys/api_linux.go (about) 1 // Package sys provides methods to read system information 2 /* 3 * Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved. 4 */ 5 package sys 6 7 const ( 8 // host OS stats 9 proc = "/proc/" 10 // to detect container vs hardware 11 rootProcess = proc + "1/cgroup" 12 hostLoadAvgPath = proc + "loadavg" 13 hostMemPath = proc + "meminfo" 14 // CPU usage by a process 15 hostProcessStatCPUPath = proc + "%d/stat" 16 // Memory usage by a process 17 hostProcessStatMemPath = proc + "%d/statm" 18 19 // container stats 20 21 // path to read all memory info for cgroup 22 contMemPath = "/sys/fs/cgroup/memory/" 23 // path to read all CPU info for cgroup 24 contCPUPath = "/sys/fs/cgroup/cpu/" 25 // memory counters 26 contMemUsedPath = contMemPath + "memory.usage_in_bytes" 27 contMemLimitPath = contMemPath + "memory.limit_in_bytes" 28 contMemStatPath = contMemPath + "memory.stat" 29 30 // time for cgroup given by scheduler before throttling cgroup 31 contCPULimit = contCPUPath + "cpu.cfs_quota_us" 32 // length of a period (quota/period ~= max number of CPU available for cgroup) 33 contCPUPeriod = contCPUPath + "cpu.cfs_period_us" 34 )