CgroupCpuUtil::validateCgroupFileContent(const std::string& content, const std::string& file_path) {
// Parses `/proc/self/cgroup` to find the current process's `cgroup` path with priority handling.
// Returns CgroupPathInfo with relative path and version, or absl::nullopt if no suitable `cgroup`
absl::optional<CgroupPathInfo> CgroupCpuUtil::getCurrentCgroupPath(Filesystem::Instance& fs) {
ENVOY_LOG_MISC(debug, "Constructed cgroup path: {} (version: {})", info.full_path, info.version);
const std::string quota_str = std::string(absl::StripAsciiWhitespace(cpu_files.quota_content));
const std::string period_str = std::string(absl::StripAsciiWhitespace(cpu_files.period_content));
ENVOY_LOG_MISC(debug, "cgroup v1 CPU ratio: {} (quota={}, period={})", cpu_ratio, quota, period);
ENVOY_LOG_MISC(warn, "Malformed cgroup v2 cpu.max: expected 'quota period', got '{}'", content);
ENVOY_LOG_MISC(debug, "cgroup v2 CPU ratio: {} (quota={}, period={})", cpu_ratio, quota, period);
ENVOY_LOG_MISC(warn, "Cannot read /proc/self/mountinfo: not in a cgroup or file doesn't exist");
ENVOY_LOG_MISC(warn, "Malformed mountinfo line: separator '-' not found or invalid position");