processLoad now returns array
This commit is contained in:
Vendored
+6
-6
@@ -529,10 +529,10 @@ export namespace Systeminformation {
|
||||
pid: number;
|
||||
parentPid: number;
|
||||
name: string,
|
||||
pcpu: number;
|
||||
pcpuu: number;
|
||||
pcpus: number;
|
||||
pmem: number;
|
||||
cpu: number;
|
||||
cpuu: number;
|
||||
cpus: number;
|
||||
mem: number;
|
||||
priority: number;
|
||||
memVsz: number;
|
||||
memRss: number;
|
||||
@@ -559,8 +559,8 @@ export namespace Systeminformation {
|
||||
running: boolean;
|
||||
startmode: string;
|
||||
pids: number[];
|
||||
pcpu: number;
|
||||
pmem: number;
|
||||
cpu: number;
|
||||
mem: number;
|
||||
}
|
||||
|
||||
// 8. Docker
|
||||
|
||||
+213
-109
@@ -190,10 +190,10 @@ function services(srv, callback) {
|
||||
running: ps.length > 0,
|
||||
startmode: '',
|
||||
pids: pids,
|
||||
pcpu: parseFloat((ps.reduce(function (pv, cv) {
|
||||
cpu: parseFloat((ps.reduce(function (pv, cv) {
|
||||
return pv + parseFloat(cv.trim().split(' ')[0]);
|
||||
}, 0)).toFixed(2)),
|
||||
pmem: parseFloat((ps.reduce(function (pv, cv) {
|
||||
mem: parseFloat((ps.reduce(function (pv, cv) {
|
||||
return pv + parseFloat(cv.trim().split(' ')[1]);
|
||||
}, 0)).toFixed(2))
|
||||
});
|
||||
@@ -228,13 +228,13 @@ function services(srv, callback) {
|
||||
}
|
||||
}
|
||||
if (listPos >= 0) {
|
||||
result[listPos].pcpu += resultProcess.pcpuu + resultProcess.pcpus;
|
||||
result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus;
|
||||
}
|
||||
|
||||
// save new values
|
||||
list_new[resultProcess.pid] = {
|
||||
pcpuu: resultProcess.pcpuu,
|
||||
pcpus: resultProcess.pcpus,
|
||||
cpuu: resultProcess.cpuu,
|
||||
cpus: resultProcess.cpus,
|
||||
utime: resultProcess.utime,
|
||||
stime: resultProcess.stime,
|
||||
cutime: resultProcess.cutime,
|
||||
@@ -269,8 +269,8 @@ function services(srv, callback) {
|
||||
name: srv,
|
||||
running: ps.length > 0,
|
||||
startmode: '',
|
||||
pcpu: 0,
|
||||
pmem: 0
|
||||
cpu: 0,
|
||||
mem: 0
|
||||
});
|
||||
});
|
||||
if (callback) { callback(result); }
|
||||
@@ -281,8 +281,8 @@ function services(srv, callback) {
|
||||
name: srv,
|
||||
running: false,
|
||||
startmode: '',
|
||||
pcpu: 0,
|
||||
pmem: 0
|
||||
cpu: 0,
|
||||
mem: 0
|
||||
});
|
||||
});
|
||||
if (callback) { callback(result); }
|
||||
@@ -314,8 +314,8 @@ function services(srv, callback) {
|
||||
running: (started === 'TRUE'),
|
||||
startmode: startMode,
|
||||
pids: [pid],
|
||||
pcpu: 0,
|
||||
pmem: 0
|
||||
cpu: 0,
|
||||
mem: 0
|
||||
});
|
||||
dataSrv.push(srvName);
|
||||
}
|
||||
@@ -331,8 +331,8 @@ function services(srv, callback) {
|
||||
running: false,
|
||||
startmode: '',
|
||||
pids: [],
|
||||
pcpu: 0,
|
||||
pmem: 0
|
||||
cpu: 0,
|
||||
mem: 0
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -344,8 +344,8 @@ function services(srv, callback) {
|
||||
name: srvName,
|
||||
running: false,
|
||||
startmode: '',
|
||||
pcpu: 0,
|
||||
pmem: 0
|
||||
cpu: 0,
|
||||
mem: 0
|
||||
});
|
||||
});
|
||||
if (callback) { callback(result); }
|
||||
@@ -394,14 +394,14 @@ function calcProcStatLinux(line, all, _cpu_old) {
|
||||
let cstime = parseInt(parts[15]);
|
||||
|
||||
// calc
|
||||
let pcpuu = 0;
|
||||
let pcpus = 0;
|
||||
let cpuu = 0;
|
||||
let cpus = 0;
|
||||
if (_cpu_old.all > 0 && _cpu_old.list[pid]) {
|
||||
pcpuu = (utime + cutime - _cpu_old.list[pid].utime - _cpu_old.list[pid].cutime) / (all - _cpu_old.all) * 100; // user
|
||||
pcpus = (stime + cstime - _cpu_old.list[pid].stime - _cpu_old.list[pid].cstime) / (all - _cpu_old.all) * 100; // system
|
||||
cpuu = (utime + cutime - _cpu_old.list[pid].utime - _cpu_old.list[pid].cutime) / (all - _cpu_old.all) * 100; // user
|
||||
cpus = (stime + cstime - _cpu_old.list[pid].stime - _cpu_old.list[pid].cstime) / (all - _cpu_old.all) * 100; // system
|
||||
} else {
|
||||
pcpuu = (utime + cutime) / (all) * 100; // user
|
||||
pcpus = (stime + cstime) / (all) * 100; // system
|
||||
cpuu = (utime + cutime) / (all) * 100; // user
|
||||
cpus = (stime + cstime) / (all) * 100; // system
|
||||
}
|
||||
return {
|
||||
pid: pid,
|
||||
@@ -409,8 +409,8 @@ function calcProcStatLinux(line, all, _cpu_old) {
|
||||
stime: stime,
|
||||
cutime: cutime,
|
||||
cstime: cstime,
|
||||
pcpuu: pcpuu,
|
||||
pcpus: pcpus
|
||||
cpuu: cpuu,
|
||||
cpus: cpus
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
@@ -419,8 +419,8 @@ function calcProcStatLinux(line, all, _cpu_old) {
|
||||
stime: 0,
|
||||
cutime: 0,
|
||||
cstime: 0,
|
||||
pcpuu: 0,
|
||||
pcpus: 0
|
||||
cpuu: 0,
|
||||
cpus: 0
|
||||
};
|
||||
}
|
||||
} else {
|
||||
@@ -430,29 +430,29 @@ function calcProcStatLinux(line, all, _cpu_old) {
|
||||
stime: 0,
|
||||
cutime: 0,
|
||||
cstime: 0,
|
||||
pcpuu: 0,
|
||||
pcpus: 0
|
||||
cpuu: 0,
|
||||
cpus: 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function calcProcStatWin(procStat, all, _cpu_old) {
|
||||
// calc
|
||||
let pcpuu = 0;
|
||||
let pcpus = 0;
|
||||
let cpuu = 0;
|
||||
let cpus = 0;
|
||||
if (_cpu_old.all > 0 && _cpu_old.list[procStat.pid]) {
|
||||
pcpuu = (procStat.utime - _cpu_old.list[procStat.pid].utime) / (all - _cpu_old.all) * 100; // user
|
||||
pcpus = (procStat.stime - _cpu_old.list[procStat.pid].stime) / (all - _cpu_old.all) * 100; // system
|
||||
cpuu = (procStat.utime - _cpu_old.list[procStat.pid].utime) / (all - _cpu_old.all) * 100; // user
|
||||
cpus = (procStat.stime - _cpu_old.list[procStat.pid].stime) / (all - _cpu_old.all) * 100; // system
|
||||
} else {
|
||||
pcpuu = (procStat.utime) / (all) * 100; // user
|
||||
pcpus = (procStat.stime) / (all) * 100; // system
|
||||
cpuu = (procStat.utime) / (all) * 100; // user
|
||||
cpus = (procStat.stime) / (all) * 100; // system
|
||||
}
|
||||
return {
|
||||
pid: procStat.pid,
|
||||
utime: procStat.utime,
|
||||
stime: procStat.stime,
|
||||
pcpuu: pcpuu,
|
||||
pcpus: pcpus
|
||||
cpuu: cpuu,
|
||||
cpus: cpus
|
||||
};
|
||||
}
|
||||
|
||||
@@ -501,9 +501,9 @@ function processes(callback) {
|
||||
checkColumn(1);
|
||||
const ppid = parseInt(line.substring(parsedhead[1].from + offset, parsedhead[1].to + offset2));
|
||||
checkColumn(2);
|
||||
const pcpu = parseFloat(line.substring(parsedhead[2].from + offset, parsedhead[2].to + offset2).replace(/,/g, '.'));
|
||||
const cpu = parseFloat(line.substring(parsedhead[2].from + offset, parsedhead[2].to + offset2).replace(/,/g, '.'));
|
||||
checkColumn(3);
|
||||
const pmem = parseFloat(line.substring(parsedhead[3].from + offset, parsedhead[3].to + offset2).replace(/,/g, '.'));
|
||||
const mem = parseFloat(line.substring(parsedhead[3].from + offset, parsedhead[3].to + offset2).replace(/,/g, '.'));
|
||||
checkColumn(4);
|
||||
const priority = parseInt(line.substring(parsedhead[4].from + offset, parsedhead[4].to + offset2));
|
||||
checkColumn(5);
|
||||
@@ -559,10 +559,10 @@ function processes(callback) {
|
||||
pid: pid,
|
||||
parentPid: ppid,
|
||||
name: _linux ? getName(command) : command,
|
||||
pcpu: pcpu,
|
||||
pcpuu: 0,
|
||||
pcpus: 0,
|
||||
pmem: pmem,
|
||||
cpu: cpu,
|
||||
cpuu: 0,
|
||||
cpus: 0,
|
||||
mem: mem,
|
||||
priority: priority,
|
||||
memVsz: vsz,
|
||||
memRss: rss,
|
||||
@@ -618,10 +618,10 @@ function processes(callback) {
|
||||
pid: parseInt(parts[0]),
|
||||
parentPid: parseInt(parts[1]),
|
||||
name: getName(command),
|
||||
pcpu: 0,
|
||||
pcpuu: 0,
|
||||
pcpus: 0,
|
||||
pmem: pmem,
|
||||
cpu: 0,
|
||||
cpuu: 0,
|
||||
cpus: 0,
|
||||
mem: pmem,
|
||||
priority: 0,
|
||||
memVsz: parseInt(parts[2]),
|
||||
memRss: parseInt(parts[3]),
|
||||
@@ -693,15 +693,15 @@ function processes(callback) {
|
||||
// store pcpu in outer array
|
||||
let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid);
|
||||
if (listPos >= 0) {
|
||||
result.list[listPos].pcpu = resultProcess.pcpuu + resultProcess.pcpus;
|
||||
result.list[listPos].pcpuu = resultProcess.pcpuu;
|
||||
result.list[listPos].pcpus = resultProcess.pcpus;
|
||||
result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus;
|
||||
result.list[listPos].cpuu = resultProcess.cpuu;
|
||||
result.list[listPos].cpus = resultProcess.cpus;
|
||||
}
|
||||
|
||||
// save new values
|
||||
list_new[resultProcess.pid] = {
|
||||
pcpuu: resultProcess.pcpuu,
|
||||
pcpus: resultProcess.pcpus,
|
||||
cpuu: resultProcess.cpuu,
|
||||
cpus: resultProcess.cpus,
|
||||
utime: resultProcess.utime,
|
||||
stime: resultProcess.stime,
|
||||
cutime: resultProcess.cutime,
|
||||
@@ -787,17 +787,17 @@ function processes(callback) {
|
||||
pid: pid,
|
||||
utime: utime,
|
||||
stime: stime,
|
||||
pcpu: 0,
|
||||
pcpuu: 0,
|
||||
pcpus: 0,
|
||||
cpu: 0,
|
||||
cpuu: 0,
|
||||
cpus: 0,
|
||||
});
|
||||
procs.push({
|
||||
pid: pid,
|
||||
parentPid: parentPid,
|
||||
name: name,
|
||||
pcpu: 0,
|
||||
pcpuu: 0,
|
||||
pcpus: 0,
|
||||
cpu: 0,
|
||||
cpuu: 0,
|
||||
cpus: 0,
|
||||
pmem: mem / os.totalmem() * 100,
|
||||
priority: parseInt(util.getValue(lines, 'Priority', '=', true), 10),
|
||||
memVsz: parseInt(util.getValue(lines, 'PageFileUsage', '=', true), 10),
|
||||
@@ -821,15 +821,15 @@ function processes(callback) {
|
||||
// store pcpu in outer array
|
||||
let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid);
|
||||
if (listPos >= 0) {
|
||||
result.list[listPos].pcpu = resultProcess.pcpuu + resultProcess.pcpus;
|
||||
result.list[listPos].pcpuu = resultProcess.pcpuu;
|
||||
result.list[listPos].pcpus = resultProcess.pcpus;
|
||||
result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus;
|
||||
result.list[listPos].cpuu = resultProcess.cpuu;
|
||||
result.list[listPos].cpus = resultProcess.cpus;
|
||||
}
|
||||
|
||||
// save new values
|
||||
list_new[resultProcess.pid] = {
|
||||
pcpuu: resultProcess.pcpuu,
|
||||
pcpus: resultProcess.pcpus,
|
||||
cpuu: resultProcess.cpuu,
|
||||
cpus: resultProcess.cpus,
|
||||
utime: resultProcess.utime,
|
||||
stime: resultProcess.stime
|
||||
};
|
||||
@@ -880,16 +880,41 @@ function processLoad(proc, callback) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
|
||||
let processesString = '';
|
||||
processesString.__proto__.toLowerCase = util.stringToLower;
|
||||
processesString.__proto__.replace = util.stringReplace;
|
||||
processesString.__proto__.trim = util.stringTrim;
|
||||
|
||||
const s = util.sanitizeShellString(proc);
|
||||
for (let i = 0; i <= 2000; i++) {
|
||||
if (!(s[i] === undefined)) {
|
||||
processesString = processesString + s[i];
|
||||
}
|
||||
}
|
||||
|
||||
processesString = processesString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|');
|
||||
if (processesString === '') {
|
||||
processesString = '*';
|
||||
}
|
||||
if (util.isPrototypePolluted() && processesString !== '*') {
|
||||
processesString = '------';
|
||||
}
|
||||
let processes = processesString.split('|');
|
||||
let result = [];
|
||||
let dataProcesses = [];
|
||||
let allProcesses = [];
|
||||
|
||||
const procSanitized = util.isPrototypePolluted() ? '' : util.sanitizeShellString(proc);
|
||||
|
||||
let result = {
|
||||
'proc': procSanitized,
|
||||
'pid': null,
|
||||
'cpu': 0,
|
||||
'mem': 0
|
||||
};
|
||||
|
||||
if (procSanitized) {
|
||||
// from here new
|
||||
// let result = {
|
||||
// 'proc': procSanitized,
|
||||
// 'pid': null,
|
||||
// 'cpu': 0,
|
||||
// 'mem': 0
|
||||
// };
|
||||
if (procSanitized && processes.length && processes[0] !== '------') {
|
||||
if (_windows) {
|
||||
try {
|
||||
util.wmic('process get /value').then((stdout, error) => {
|
||||
@@ -899,6 +924,8 @@ function processLoad(proc, callback) {
|
||||
let list_new = {};
|
||||
let allcpuu = 0;
|
||||
let allcpus = 0;
|
||||
|
||||
// go through all processes
|
||||
for (let i = 0; i < processSections.length; i++) {
|
||||
if (processSections[i].trim() !== '') {
|
||||
let lines = processSections[i].trim().split('\r\n');
|
||||
@@ -912,43 +939,67 @@ function processLoad(proc, callback) {
|
||||
|
||||
procStats.push({
|
||||
pid: pid,
|
||||
name,
|
||||
utime: utime,
|
||||
stime: stime,
|
||||
pcpu: 0,
|
||||
pcpuu: 0,
|
||||
pcpus: 0,
|
||||
cpu: 0,
|
||||
cpuu: 0,
|
||||
cpus: 0,
|
||||
mem
|
||||
});
|
||||
if (name.toLowerCase().indexOf(procSanitized.toLowerCase()) >= 0) {
|
||||
if (result.pid === null) {
|
||||
result = {
|
||||
if (processesString === '*' || processes.indexOf(name.toLowerCase()) >= 0) {
|
||||
let processFound = false;
|
||||
result.forEach(function (item) {
|
||||
if (item.proc.toLowerCase() === name.toLowerCase()) {
|
||||
item.pids.push(pid);
|
||||
item.mem += mem / os.totalmem() * 100;
|
||||
processFound = true;
|
||||
}
|
||||
})
|
||||
if (!processFound) {
|
||||
result.push({
|
||||
proc: name,
|
||||
pid: pid,
|
||||
pids: [pid],
|
||||
cpu: 0,
|
||||
mem: mem / os.totalmem() * 100
|
||||
};
|
||||
} else {
|
||||
result.pids.push(pid);
|
||||
result.mem += mem / os.totalmem() * 100;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// add missing processes
|
||||
if (processesString !== '*') {
|
||||
let processesMissing = processes.filter(function (name) {
|
||||
return procStats.filter(function(item) { return item.name.toLowerCase() === name }).length === 0;
|
||||
});
|
||||
processesMissing.forEach(function (procName) {
|
||||
result.push({
|
||||
proc: procName,
|
||||
pid: null,
|
||||
pids: [],
|
||||
cpu: 0,
|
||||
mem: 0
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// calculate proc stats for each proc
|
||||
for (let i = 0; i < procStats.length; i++) {
|
||||
let resultProcess = calcProcStatWin(procStats[i], allcpuu + allcpus, _process_cpu);
|
||||
|
||||
// store pcpu in outer array
|
||||
if (result && result.pids && result.pids.length > 0) {
|
||||
let listPos = result.pids.indexOf(resultProcess.pid);
|
||||
if (listPos >= 0) {
|
||||
result.cpu = resultProcess.pcpuu + resultProcess.pcpus;
|
||||
}
|
||||
let listPos = 0;
|
||||
for (let j = 0; j < result.length; j++) {
|
||||
if (result[j].pid === resultProcess.pid || result[j].pids.indexOf(resultProcess.pid) >= 0) { listPos === j; }
|
||||
}
|
||||
if (listPos >= 0) {
|
||||
result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus;
|
||||
}
|
||||
|
||||
// save new values
|
||||
list_new[resultProcess.pid] = {
|
||||
pcpuu: resultProcess.pcpuu,
|
||||
pcpus: resultProcess.pcpus,
|
||||
cpuu: resultProcess.cpuu,
|
||||
cpus: resultProcess.cpus,
|
||||
utime: resultProcess.utime,
|
||||
stime: resultProcess.stime
|
||||
};
|
||||
@@ -958,8 +1009,7 @@ function processLoad(proc, callback) {
|
||||
// _process_cpu.list = list_new;
|
||||
_process_cpu.list = Object.assign({}, list_new);
|
||||
_process_cpu.ms = Date.now() - _process_cpu.ms;
|
||||
// _process_cpu.result = result;
|
||||
_process_cpu.result = Object.assign({}, result);
|
||||
_process_cpu.result = JSON.parse(JSON.stringify(result));
|
||||
if (callback) {
|
||||
callback(result);
|
||||
}
|
||||
@@ -976,30 +1026,84 @@ function processLoad(proc, callback) {
|
||||
const params = '-axo pid,pcpu,pmem,comm';
|
||||
execFile('ps', params.split(' '), { maxBuffer: 1024 * 20000 }, function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n').filter(line => line.toLowerCase().indexOf(procSanitized.toLowerCase()) >= 0 && line.toLowerCase().indexOf('grep') === -1);
|
||||
|
||||
let pid = 0;
|
||||
let pids = [];
|
||||
let cpu = 0;
|
||||
let mem = 0;
|
||||
let procStats = [];
|
||||
let lines = stdout.toString().split('\n').filter(function (line) {
|
||||
if (processesString === '*') return true;
|
||||
if (line.toLowerCase().indexOf('grep') !== -1) return false; // remove this??
|
||||
let found = false;
|
||||
processes.forEach(function (item) {
|
||||
found = found || (line.toLowerCase().indexOf(item.toLowerCase()) >= 0)
|
||||
})
|
||||
return found;
|
||||
});
|
||||
|
||||
lines.forEach(function (line) {
|
||||
let data = line.trim().replace(/ +/g, ' ').split(' ');
|
||||
if (data.length > 3) {
|
||||
pid = (!pid ? parseInt(data[0]) : 0);
|
||||
pids.push(parseInt(data[0], 10));
|
||||
cpu = cpu + parseFloat(data[1].replace(',', '.'));
|
||||
mem = mem + parseFloat(data[2].replace(',', '.'));
|
||||
procStats.push({
|
||||
name: data[3].substring(data[3].lastIndexOf('/') + 1),
|
||||
pid: parseInt(data[0]) || 0,
|
||||
cpu: parseFloat(data[1].replace(',', '.')),
|
||||
mem: parseFloat(data[2].replace(',', '.'))
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
result = {
|
||||
'proc': procSanitized,
|
||||
'pid': pid,
|
||||
'pids': pids,
|
||||
'cpu': parseFloat((cpu / lines.length).toFixed(2)),
|
||||
'mem': parseFloat((mem / lines.length).toFixed(2))
|
||||
};
|
||||
procStats.forEach(function (item) {
|
||||
let listPos = -1;
|
||||
let inList = false;
|
||||
let name = ''
|
||||
for (let j = 0; j < result.length; j++) {
|
||||
// if (result[j].proc.toLowerCase() === item.name.toLowerCase()) {
|
||||
// if (result[j].proc.toLowerCase().indexOf(item.name.toLowerCase()) >= 0) {
|
||||
if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) {
|
||||
listPos = j;
|
||||
}
|
||||
}
|
||||
// console.log(listPos);
|
||||
processes.forEach(function (proc) {
|
||||
// console.log(proc)
|
||||
// console.log(item)
|
||||
// inList = inList || item.name.toLowerCase() === proc.toLowerCase();
|
||||
if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) {
|
||||
inList = true;
|
||||
name = proc;
|
||||
}
|
||||
})
|
||||
// console.log(item);
|
||||
// console.log(listPos);
|
||||
if ((processesString === '*') || inList) {
|
||||
if (listPos < 0) {
|
||||
result.push({
|
||||
proc: name,
|
||||
pid: item.pid,
|
||||
pids: [item.pid],
|
||||
cpu: item.cpu,
|
||||
mem: item.mem
|
||||
})
|
||||
} else {
|
||||
result[listPos].pids.push(item.pid);
|
||||
result[listPos].cpu += item.cpu;
|
||||
result[listPos].mem += item.mem;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (processesString !== '*') {
|
||||
// add missing processes
|
||||
let processesMissing = processes.filter(function (name) {
|
||||
return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0 }).length === 0;
|
||||
});
|
||||
processesMissing.forEach(function (procName) {
|
||||
result.push({
|
||||
proc: procName,
|
||||
pid: null,
|
||||
pids: [],
|
||||
cpu: 0,
|
||||
mem: 0
|
||||
});
|
||||
});
|
||||
}
|
||||
if (_linux) {
|
||||
// calc process_cpu - ps is not accurate in linux!
|
||||
let cmd = 'cat /proc/stat | grep "cpu "';
|
||||
@@ -1023,12 +1127,12 @@ function processLoad(proc, callback) {
|
||||
if (resultProcess.pid) {
|
||||
|
||||
// store pcpu in outer result
|
||||
result.cpu += resultProcess.pcpuu + resultProcess.pcpus;
|
||||
result.cpu += resultProcess.cpuu + resultProcess.cpus;
|
||||
|
||||
// save new values
|
||||
list_new[resultProcess.pid] = {
|
||||
pcpuu: resultProcess.pcpuu,
|
||||
pcpus: resultProcess.pcpus,
|
||||
cpuu: resultProcess.cpuu,
|
||||
cpus: resultProcess.cpus,
|
||||
utime: resultProcess.utime,
|
||||
stime: resultProcess.stime,
|
||||
cutime: resultProcess.cutime,
|
||||
|
||||
Reference in New Issue
Block a user