mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 17:32:16 +00: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)
|