nix-super/src/libutil/cgroup.hh

32 lines
590 B
C++
Raw Normal View History

2020-05-16 22:09:48 +03:00
#pragma once
#if __linux__
2022-11-18 14:40:59 +02:00
#include <chrono>
#include <optional>
2020-05-16 22:09:48 +03:00
#include "types.hh"
namespace nix {
std::optional<Path> getCgroupFS();
2020-05-16 22:21:41 +03:00
std::map<std::string, std::string> getCgroups(const Path & cgroupFile);
2022-11-18 14:40:59 +02:00
struct CgroupStats
{
std::optional<std::chrono::microseconds> cpuUser, cpuSystem;
};
/**
* Destroy the cgroup denoted by 'path'. The postcondition is that
* 'path' does not exist, and thus any processes in the cgroup have
* been killed. Also return statistics from the cgroup just before
* destruction.
*/
2022-11-18 14:40:59 +02:00
CgroupStats destroyCgroup(const Path & cgroup);
2020-05-16 22:09:48 +03:00
}
#endif