26#include <ContainerId.h>
28#include "IDobbyUtils.h"
36#include <jsoncpp/json.h>
57 const std::shared_ptr<IDobbyEnv> &env,
58 const std::shared_ptr<IDobbyUtils> &utils);
62 const Json::Value &stats()
const;
69 const std::string fileName;
70 const std::string cmdline;
72 inline void Serialise(Json::Value &root)
75 root[
"nsPid"] = nsPid;
76 root[
"executable"] = fileName;
77 root[
"cmdline"] = cmdline;
83 const std::string &cgroupMntPath,
84 const std::string &cgroupfileName,
85 char *buf,
size_t bufLen);
88 const std::string &cgroupMntPath,
89 const std::string &cgroupfileName);
92 const std::string &cgroupMntPath,
93 const std::string &cgroupfileName);
95 static Json::Value readMultipleCgroupValuesJson(
const ContainerId &
id,
96 const std::string &cgroupMntPath,
97 const std::string &cgroupfileName);
100 const std::shared_ptr<IDobbyEnv> &env,
101 const std::shared_ptr<IDobbyUtils> &utils);
104 const std::string &cpuCgroupMntPath,
105 const std::shared_ptr<IDobbyUtils> &utils);
108 static Json::Value readIonCgroupHeaps(
const ContainerId &
id,
109 const std::string &ionCgroupPath);
113 const std::shared_ptr<IDobbyUtils> &utils);
118 const Json::Value mStats;
A wrapper around a std::string, used to add some type definition to to an id and also to sanity check...
Definition ContainerId.h:41
Small utility class used to get the stats of a container.
Definition DobbyStats.h:54
static pid_t readNsPidFromProc(pid_t pid)
Given a pid (in global namespace) tries to find what it's namespace pid is.
Definition DobbyStats.cpp:522
static Process getProcessInfo(pid_t pid, const std::shared_ptr< IDobbyUtils > &utils)
Returns information about a given PID.
Definition DobbyStats.cpp:469
static ssize_t readCgroupFile(const ContainerId &id, const std::string &cgroupMntPath, const std::string &cgroupfileName, char *buf, size_t bufLen)
Reads a maximum of 4096 bytes from the given cgroup file.
Definition DobbyStats.cpp:275
static Json::Value readSingleCgroupValue(const ContainerId &id, const std::string &cgroupMntPath, const std::string &cgroupfileName)
Reads a single value from the given cgroup file.
Definition DobbyStats.cpp:319
static std::vector< int64_t > readMultipleCgroupValues(const ContainerId &id, const std::string &cgroupMntPath, const std::string &cgroupfileName)
Reads multiple values from the given cgroup file.
Definition DobbyStats.cpp:363
static Json::Value getProcessTree(const ContainerId &id, const std::string &cpuCgroupMntPath, const std::shared_ptr< IDobbyUtils > &utils)
Builds a json array of the processes running in the container.
Definition DobbyStats.cpp:436
static Json::Value getStats(const ContainerId &id, const std::shared_ptr< IDobbyEnv > &env, const std::shared_ptr< IDobbyUtils > &utils)
Gets the stats for the container.
Definition DobbyStats.cpp:110
Interface that exports the environment of the daemon to plugins.
Definition IDobbyEnv.h:46
Definition DobbyStats.h:66