vtop
vtop copied to clipboard
Should memory only display the used memory?
The memory graph displays the total memory - used memory plus cached and buffered memory. I think the graph should display only the used memory or two/three graphs for the buffered memory aswell.
Due to the use of os-utils, we need to go down one level of abstraction and modify the code used by os-utils..
exports.freeCommand = function(callback){
// Only Linux
require('child_process').exec('free -m', function(error, stdout, stderr) {
var lines = stdout.split("\n");
var str_mem_info = lines[1].replace( /[\s\n\r]+/g,' ');
var mem_info = str_mem_info.split(' ')
total_mem = parseFloat(mem_info[1])
free_mem = parseFloat(mem_info[3])
buffers_mem = parseFloat(mem_info[5])
cached_mem = parseFloat(mem_info[6])
used_mem = total_mem - (free_mem + buffers_mem + cached_mem)
callback(used_mem -2);
});
}
@cwildfoerster why not make a PR?
@cwildfoerster Fix in fork #128