You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/06/10 03:36:37 UTC

mesos git commit: Ensure memory is treated as floating point in mesos-ps.

Repository: mesos
Updated Branches:
  refs/heads/master 53f487386 -> 80a94ceea


Ensure memory is treated as floating point in mesos-ps.

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


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

Branch: refs/heads/master
Commit: 80a94ceea49bde134ae179cb1333de328db07358
Parents: 53f4873
Author: weitao zhou <zh...@gmail.com>
Authored: Tue Jun 9 18:35:27 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Tue Jun 9 18:36:23 2015 -0700

----------------------------------------------------------------------
 src/cli/mesos-ps | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/80a94cee/src/cli/mesos-ps
----------------------------------------------------------------------
diff --git a/src/cli/mesos-ps b/src/cli/mesos-ps
index ae48c8c..ee14d51 100755
--- a/src/cli/mesos-ps
+++ b/src/cli/mesos-ps
@@ -103,14 +103,17 @@ def mem(task, statistics):
     return None
 
 def data_size(bytes, format):
+    # Ensure bytes is treated as floating point for the math below.
+    bytes = float(bytes)
+
     if bytes < 1024:
         return (format % bytes) + ' B'
     elif bytes < (1024 * 1024):
-        return (format % (bytes / 1024.0)) + ' KB'
+        return (format % (bytes / 1024)) + ' KB'
     elif bytes < (1024 * 1024 * 1024):
-        return (format % (bytes / (1024.0 * 1024.0))) + ' MB'
+        return (format % (bytes / (1024 * 1024))) + ' MB'
     else:
-        return (format % (bytes / (1024.0 * 1024.0 * 1024.0))) + ' GB'
+        return (format % (bytes / (1024 * 1024 * 1024))) + ' GB'
 
 
 # Helper for formatting the TIME column for a task.