node-usage

node-usage JS library on npm Download node-usage JS library

a process usage monitor with nodejs

Version 0.0.3 License ISC
node-usage has no homepage
node-usage JS library on GitHub
node-usage JS library on npm
Download node-usage JS library
<script type="module"> import nodeUsage from 'https://cdn.jsdelivr.net/npm/node-usage@0.0.3/+esm' </script>
Learn more

node-usage

a process usage monitor with nodejs

  • support MEM, RSS, VSZ, %MEM, %CPU
  • support process group usage monitor

usage

$ npm install node-usage

then just use it in your codes like this

  import UsageMonitor from 'node-usage';

  const memMonitor = new UsageMonitor({ interval: 500 });
  memMonitor.run(p.pid, (err, data) => {
    console.log(data);
  });

the default monitor will count child process memory, virtual memory size, and physical resident memory into result. you can disable it like this:

  memMonitor.run(p.pid, { countChild: false },  (err, data) => {
    console.log(data);
  });

LICENSE

MIT