MCPcopy Create free account
hub / github.com/catboost/catboost / CgroupCpus

Function CgroupCpus

util/system/info.cpp:102–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static 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
124size_t NSystemInfo::NumberOfMillicores() {

Callers 2

NumberOfMillicoresMethod · 0.85
NumberOfCpusMethod · 0.85

Calls 2

CgroupV2CpusFunction · 0.85
CgroupV1CpusFunction · 0.85

Tested by

no test coverage detected