Repository: mesos Updated Branches: refs/heads/master 5b4b18d63 -> ecb2303ca
cgroups: added memsw_usage_in_bytes. Review: https://reviews.apache.org/r/31914 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f1254a69 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f1254a69 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f1254a69 Branch: refs/heads/master Commit: f1254a69a763f8d2f0c72b7fb9e24aa3088a538e Parents: 5b4b18d Author: Chi Zhang <[email protected]> Authored: Fri Jun 12 16:03:41 2015 -0700 Committer: Ian Downes <[email protected]> Committed: Fri Jun 12 16:03:42 2015 -0700 ---------------------------------------------------------------------- src/linux/cgroups.cpp | 13 +++++++++++++ src/linux/cgroups.hpp | 6 ++++++ 2 files changed, 19 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/f1254a69/src/linux/cgroups.cpp ---------------------------------------------------------------------- diff --git a/src/linux/cgroups.cpp b/src/linux/cgroups.cpp index 831237b..a612fab 100644 --- a/src/linux/cgroups.cpp +++ b/src/linux/cgroups.cpp @@ -2136,6 +2136,19 @@ Try<Bytes> usage_in_bytes(const string& hierarchy, const string& cgroup) } +Try<Bytes> memsw_usage_in_bytes(const string& hierarchy, const string& cgroup) +{ + Try<string> read = cgroups::read( + hierarchy, cgroup, "memory.memsw.usage_in_bytes"); + + if (read.isError()) { + return Error(read.error()); + } + + return Bytes::parse(strings::trim(read.get()) + "B"); +} + + Try<Bytes> max_usage_in_bytes(const string& hierarchy, const string& cgroup) { Try<string> read = cgroups::read( http://git-wip-us.apache.org/repos/asf/mesos/blob/f1254a69/src/linux/cgroups.hpp ---------------------------------------------------------------------- diff --git a/src/linux/cgroups.hpp b/src/linux/cgroups.hpp index f3a6c50..73b9831 100644 --- a/src/linux/cgroups.hpp +++ b/src/linux/cgroups.hpp @@ -490,6 +490,12 @@ Try<Bytes> usage_in_bytes( const std::string& cgroup); +// Returns the memory + swap usage from memory.memsw.usage_in_bytes. +Try<Bytes> memsw_usage_in_bytes( + const std::string& hierarchy, + const std::string& cgroup); + + // Returns the max memory usage from memory.max_usage_in_bytes. Try<Bytes> max_usage_in_bytes( const std::string& hierarchy,
