Adding CPU & Memory metrics for App

This commit is contained in:
Hari Juturu 2017-05-15 17:41:45 -07:00 committed by Hari Krishna Reddy Juturu
parent 0d2aa5c027
commit 939747945e
9 changed files with 159 additions and 34 deletions

View file

@ -534,15 +534,18 @@ describe('app module', function () {
})
})
describe('getAppMemoryInfo() API', function () {
describe.only('getAppMetrics() API', function () {
it('returns the process memory of all running electron processes', function () {
const appMemoryInfo = app.getAppMemoryInfo()
assert.ok(appMemoryInfo.length > 0, 'App memory info object is not > 0')
for (const {memory, pid} of appMemoryInfo) {
const appMetrics = app.getAppMetrics()
assert.ok(appMetrics.length > 0, 'App memory info object is not > 0')
for (const {memory, pid, type, cpu} of appMetrics) {
assert.ok(memory.workingSetSize > 0, 'working set size is not > 0')
assert.ok(memory.privateBytes > 0, 'private bytes is not > 0')
assert.ok(memory.sharedBytes > 0, 'shared bytes is not > 0')
assert.ok(pid > 0, 'pid is not > 0')
assert.ok(type.length > 0, 'process type is null')
assert.equal(typeof cpu.percentCPUUsage, 'number')
assert.equal(typeof cpu.idleWakeupsPerSecond, 'number')
}
})
})