15 #ifndef IMPALA_UTIL_CGROUPS_MGR_H
16 #define IMPALA_UTIL_CGROUPS_MGR_H
19 #include <boost/thread/mutex.hpp>
20 #include <boost/unordered_map.hpp>
86 Status Init(
const std::string& cgroups_hierarchy_path,
87 const std::string& staging_cgroup);
104 const std::string& cgroup,
bool* is_first);
113 const std::string& cgroup);
142 const std::string& dst_cgroup)
const;
149 std::string* cgroup_path, std::string* tasks_path)
const;
int32_t VirtualCoresToCpuShares(int16_t v_cpu_cores)
Status CreateCgroup(const std::string &cgroup, bool if_not_exists) const
Status DropCgroup(const std::string &cgroup, bool if_exists) const
Status RegisterFragment(const TUniqueId &fragment_instance_id, const std::string &cgroup, bool *is_first)
TODO: Consider allowing fragment IDs as category parameters.
std::string staging_cgroup_
std::string UniqueIdToCgroup(const std::string &unique_id) const
class SimpleMetric< int64_t, TMetricKind::COUNTER > IntCounter
MetricGroups may be organised hierarchically as a tree.
Status SetCpuShares(const std::string &cgroup, int32_t num_shares)
boost::mutex active_cgroups_lock_
Protects active_cgroups_.
std::string cgroups_hierarchy_path_
Root of the CPU cgroup hierarchy. Created cgroups are placed directly under it.
CgroupsMgr(MetricGroup *metrics)
Status Init(const std::string &cgroups_hierarchy_path, const std::string &staging_cgroup)
Status AssignThreadToCgroup(const Thread &thread, const std::string &cgroup) const
Status RelocateThreads(const std::string &src_cgroup, const std::string &dst_cgroup) const
boost::unordered_map< std::string, int32_t > active_cgroups_
Status GetCgroupPaths(const std::string &cgroup, std::string *cgroup_path, std::string *tasks_path) const
IntCounter * active_cgroups_metric_
Number of currently active Impala-managed cgroups.
Status UnregisterFragment(const TUniqueId &fragment_instance_id, const std::string &cgroup)