I am working on an application which gives top 5 CPU usage applications names. Currently, I have got top 5 applications from the following code:
var _ = require('lodash');
var ps = require('current-processes');
ps.get(function(err, processes) {
var sorted = _.sortBy(processes, 'cpu');
var top5 = sorted.reverse().splice(0, 5); // Top 5 results
console.log(top5);
});
Output: Attaching o/p in image:
I have worked on other method as well:
var exec = require('child_process').exec;
exec('tasklist', function(err, stdout, stderr) {
var lines = stdout.toString().split('\n');
console.log(lines);
});
Output Image
But I am unable to identify whether the process(pid) is of windows services or other application. In short, I don't want to show any system service. Is there any other way to identify this?