aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/cgroup.hh
blob: 574ae8e5b1acd09dc638c7a9b64043033a9673d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
///@file

#if __linux__

#include <chrono>
#include <optional>

#include "types.hh"

namespace nix {

std::optional<Path> getCgroupFS();

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