```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)
```

Monitor event loop by looking for skew
user
```coffeescript
module.exports = EventLoopMonitor =
	monitor: (logger, interval = 1000, log_threshold = 100) ->
		Metrics = require "./metrics"
		
		previous = Date.now()
		intervalId = setInterval () ->
			now = Date.now()
			offset = now - previous - interval
			if offset > log_threshold
				logger.warn {offset: offset}, "slow event loop"
			previous = now
			Metrics.timing("event-loop-millsec", offset)
		, interval
		
		Metrics.registerDestructor () ->
			clearInterval(intervalId)
```
assistant