0.0.4 • Published 7 years ago

cpu-timer v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

cpu-timer

easy to use

var cpuTimer = require( 'cpu-timer' )

var timer = cpuTimer.create()
setTimeout(function () {
  var cpu = timer.cpu()
  console.log( 'process usage: ' + cpu.usage + ' %' )
  console.log( 'system total average: ' + cpu.average + ' %' )
}, 1000)

// or help functions setTimeout and setInterval

cpuTimer.setTimeout(function ( cpu ) {
  console.log( 'process usage: ' + cpu.usage + ' %' )
  console.log( 'system total average: ' + cpu.average + ' %' )
}, 1000)

API

var cpuTimer = require( 'cpu-timer' )

cpuTimer.setTimeout( callback, delay ) // get process and system average cpu % over 'delay' ms

cpuTimer.setInterval( callback, delay ) // safe setInterval ( using setTimeout's, not setInterval )

var timer = cpuTimer.create( callback, delay ) // returns a timer

// get usage and system average cpu % since the last time timer.cpu() was called
// ( called implicitly on creation )
var cpu = timer.cpu() // cpu { usage: 0-100, average: 0-100 }

About

TODO

How

TODO

test

npm test
0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago