Skip to content

Commit

Permalink
Merge pull request #1517 from blocktrron/pr-memory-calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
neocturne authored Aug 24, 2018
2 parents 20d22f6 + 02dfc66 commit d3d6637
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package/gluon-respondd/src/respondd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion package/gluon-status-page/javascript/status-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d3d6637

Please sign in to comment.