| 100 | } |
| 101 | |
| 102 | static inline double CgroupCpus() { |
| 103 | static const TString cpuMaxPath("/sys/fs/cgroup/cpu.max"); |
| 104 | static const TString cpuCfsQuotaUsPath("/sys/fs/cgroup/cpu/cpu.cfs_quota_us"); |
| 105 | static const TString cfsPeriodUsPath("/sys/fs/cgroup/cpu/cpu.cfs_period_us"); |
| 106 | |
| 107 | if (NFs::Exists(cpuMaxPath)) { |
| 108 | auto cgroup2Cpus = CgroupV2Cpus(cpuMaxPath); |
| 109 | if (cgroup2Cpus > 0) { |
| 110 | return cgroup2Cpus; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | if (NFs::Exists(cpuCfsQuotaUsPath) && NFs::Exists(cfsPeriodUsPath)) { |
| 115 | auto cgroups1Cpus = CgroupV1Cpus(cpuCfsQuotaUsPath, cfsPeriodUsPath); |
| 116 | if (cgroups1Cpus > 0) { |
| 117 | return cgroups1Cpus; |
| 118 | } |
| 119 | } |
| 120 | return 0; |
| 121 | } |
| 122 | #endif |
| 123 | |
| 124 | size_t NSystemInfo::NumberOfMillicores() { |
no test coverage detected