You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2014/02/04 00:00:27 UTC

[2/2] git commit: Added free and total memory to /system/stats.json.

Added free and total memory to /system/stats.json.

This patch expose the number bytes of total and free memory in
the /system/stats.json.

Review: https://reviews.apache.org/r/17569


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d3e277d0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d3e277d0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d3e277d0

Branch: refs/heads/master
Commit: d3e277d0478413d46f49f6c2a9d135ad01a4805e
Parents: 679eca5
Author: Niklas Q. Nielsen <ni...@mesosphere.io>
Authored: Mon Feb 3 22:30:03 2014 +0000
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Mon Feb 3 22:30:03 2014 +0000

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/system.hpp | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d3e277d0/3rdparty/libprocess/include/process/system.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/system.hpp b/3rdparty/libprocess/include/process/system.hpp
index 2bf8716..fbd1eaa 100644
--- a/3rdparty/libprocess/include/process/system.hpp
+++ b/3rdparty/libprocess/include/process/system.hpp
@@ -46,6 +46,12 @@ private:
       object.values["cpus_total"] = cpus.get();
     }
 
+    Try<os::Memory> memory = os::memory();
+    if (memory.isSome()) {
+      object.values["mem_total_bytes"] = memory.get().total.bytes();
+      object.values["mem_free_bytes"] = memory.get().free.bytes();
+    }
+
     return http::OK(object, request.query.get("jsonp"));
   }
 };