Adding CPU and I/O metrics to process module

This commit is contained in:
Hari Krishna Reddy Juturu 2017-05-04 10:49:01 -07:00
parent 70e199e255
commit 8a5aa04756
5 changed files with 84 additions and 0 deletions

23
spec/api-process-spec.js Normal file
View file

@ -0,0 +1,23 @@
const assert = require('assert')
describe('process module', function () {
describe('process.getCPUUsage()', function () {
it('returns a cpu usage object', function () {
var cpuUsage = process.getCPUUsage()
assert.equal(typeof cpuUsage.percentCPUUsage, 'number')
assert.equal(typeof cpuUsage.idleWakeupsPerSecond, 'number')
})
})
describe('process.getIOCounters()', function () {
it('returns an io counters object', function () {
var ioCounters = process.getIOCounters()
assert.ok(ioCounters.readOperationCount > 0, 'read operation count not > 0')
assert.ok(ioCounters.writeOperationCount > 0, 'write operation count not > 0')
assert.ok(ioCounters.otherOperationCount > 0, 'other operation count not > 0')
assert.ok(ioCounters.readTransferCount > 0, 'read transfer count not > 0')
assert.ok(ioCounters.writeTransferCount > 0, 'write transfer count not > 0')
assert.ok(ioCounters.otherTransferCount > 0, 'other transfer count not > 0')
})
})
})