Package Exports
- cpu-stats
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cpu-stats) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cpu-stats
Calls a callback with the current CPU utilisation status in percent per core.
var cpuStats = require('cpu-stats')
// the first argument is how long to sample for in ms.
// longer is more accurate but, you know, longer.
// if omitted, defaults to one second.
cpuStats(1000, function(error, result) {
if(error) return console.error('Oh noes!', error) // actually this will never happen
console.info(result)
})
Will output:
[
{ cpu: 14, user: 7, nice: 0, sys: 7, idle: 86, irq: 0 },
{ cpu: 3, user: 1, nice: 0, sys: 2, idle: 97, irq: 0 },
{ cpu: 9, user: 5, nice: 0, sys: 4, idle: 91, irq: 0 },
{ cpu: 2, user: 1, nice: 0, sys: 1, idle: 98, irq: 0 }
]
All numbers are in % and will probably not be integers.
cpu
is a convenience addition of all activity per core minus idle time.