diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-12-02 12:38:03 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-12-02 12:38:03 +0100 |
commit | 1211e59a038379026496bbee4b203bbd66833b01 (patch) | |
tree | 910f7b3fd607620811fb574c1e302a128a8b53d9 /src/libutil/cgroup.hh | |
parent | ca42068bdc26108cfbd9f7db8af03730bc66d13a (diff) |
Move cgroup.{cc,hh} to libutil
Diffstat (limited to 'src/libutil/cgroup.hh')
-rw-r--r-- | src/libutil/cgroup.hh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libutil/cgroup.hh b/src/libutil/cgroup.hh new file mode 100644 index 000000000..3ead4735f --- /dev/null +++ b/src/libutil/cgroup.hh @@ -0,0 +1,27 @@ +#pragma once + +#if __linux__ + +#include <chrono> +#include <optional> + +#include "types.hh" + +namespace nix { + +std::map<std::string, std::string> getCgroups(const Path & cgroupFile); + +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. */ +CgroupStats destroyCgroup(const Path & cgroup); + +} + +#endif |