mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 06:53:41 -05:00
19 lines
467 B
CoffeeScript
19 lines
467 B
CoffeeScript
|
seconds = 1000
|
||
|
|
||
|
module.exports = EventLoopMonitor =
|
||
|
monitor: (logger) ->
|
||
|
interval = setInterval () ->
|
||
|
EventLoopMonitor.Delay()
|
||
|
, 1 * seconds
|
||
|
Metrics = require "./metrics"
|
||
|
Metrics.registerDestructor () ->
|
||
|
clearInterval(interval)
|
||
|
|
||
|
Delay: () ->
|
||
|
Metrics = require "./metrics"
|
||
|
t1 = process.hrtime()
|
||
|
setImmediate () ->
|
||
|
delta = process.hrtime(t1)
|
||
|
responseTime = delta[0]*1e6 + delta[1]*1e-3
|
||
|
Metrics.timing("event-loop-microsec", responseTime)
|