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 {
|
|
|
|
|
2022-12-02 13:57:41 +02:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2023-03-27 04:12:25 +03:00
|
|
|
/**
|
|
|
|
* 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
|