UNPKG

elastic-apm-node

Version:

The official Elastic APM agent for Node.js

17 lines (12 loc) 341 B
'use strict' const os = require('os') const processTop = require('./process-top')() const cpus = os.cpus() module.exports = function processCPUUsage () { const cpu = processTop.cpu() return { total: cpu.percent / cpus.length, user: (cpu.user / cpu.time) / cpus.length, system: (cpu.system / cpu.time) / cpus.length } }