vtop icon indicating copy to clipboard operation
vtop copied to clipboard

Should memory only display the used memory?

Open cwildfoerster opened this issue 10 years ago • 2 comments

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 avatar Jun 10 '14 16:06 cwildfoerster

@cwildfoerster why not make a PR?

jameelmoses avatar Mar 14 '18 15:03 jameelmoses

@cwildfoerster Fix in fork #128

pfych avatar Jul 23 '18 01:07 pfych