HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/.pm2/modules/pm2-logrotate/node_modules/pmx/lib/probes/loop_delay.js
module.exports = function (pmx) {
  var TIME_INTERVAL = 1000

  var oldTime = process.hrtime()

  var histogram = pmx.probe().histogram({
    name: 'Loop delay',
    type: 'libuv/latency',
    measurement: 'mean',
    unit: 'ms'
  })

  var worker = setInterval(function () {
    var newTime = process.hrtime()
    var delay = (newTime[0] - oldTime[0]) * 1e3 + (newTime[1] - oldTime[1]) / 1e6 - TIME_INTERVAL
    oldTime = newTime
    histogram.update(delay)
  }, TIME_INTERVAL)

  worker.unref()
}