Commit d3d6637c authored by Matthias Schiffer's avatar Matthias Schiffer Committed by GitHub

Merge pull request #1517 from blocktrron/pr-memory-calculation

parents 20d22f66 02dfc664
......@@ -197,6 +197,8 @@ static struct json_object * get_memory(void) {
json_object_object_add(ret, "total", json_object_new_int(value));
else if (!strcmp(label, "MemFree"))
json_object_object_add(ret, "free", json_object_new_int(value));
else if (!strcmp(label, "MemAvailable"))
json_object_object_add(ret, "available", json_object_new_int(value));
else if (!strcmp(label, "Buffers"))
json_object_object_add(ret, "buffers", json_object_new_int(value));
else if (!strcmp(label, "Cached"))
......
......@@ -74,7 +74,7 @@
return _['%s used'].sprintf(formatNumber(100 * value, 3) + '%');
},
'memory': function(memory) {
var usage = 1 - (memory.free + memory.buffers + memory.cached) / memory.total
var usage = 1 - memory.available / memory.total
return formats.percent(usage);
},
'time': function(seconds) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment