Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. var pusage = require('pidusage')
  2.  
  3. pusage.stat(process.pid, function(err, stat) {
  4.  
  5. expect(err).to.be.null
  6. expect(stat).to.be.an('object')
  7. expect(stat).to.have.property('cpu')
  8. expect(stat).to.have.property('memory')
  9.  
  10. console.log('Pcpu: %s', stat.cpu)
  11. console.log('Mem: %s', stat.memory) //those are bytes
  12.  
  13. })
  14.  
  15. // Unmonitor process
  16. pusage.unmonitor(process.pid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement