Nix/src/libutil/cgroup.hh

33 lines
599 B
C++
Raw Normal View History

2020-05-16 21:09:48 +02:00
#pragma once
///@file
2020-05-16 21:09:48 +02:00
#if __linux__
2022-11-18 13:40:59 +01:00
#include <chrono>
#include <optional>
2020-05-16 21:09:48 +02:00
#include "types.hh"
namespace nix {
std::optional<Path> getCgroupFS();
2020-05-16 21:21:41 +02:00
std::map<std::string, std::string> getCgroups(const Path & cgroupFile);
2022-11-18 13:40:59 +01: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 13:40:59 +01:00
CgroupStats destroyCgroup(const Path & cgroup);
2020-05-16 21:09:48 +02:00
}
#endif