Class: Goliath::Plugin::Latency
- Inherits:
-
Object
- Object
- Goliath::Plugin::Latency
- Defined in:
- lib/goliath/plugins/latency.rb
Overview
Report latency information about the EventMachine reactor to the log file.
Instance Method Summary (collapse)
-
- (Goliath::Plugin::Latency) initialize(port, config, status, logger)
constructor
Called by the framework to initialize the plugin.
-
- (Object) run
Called automatically to start the plugin.
Constructor Details
- (Goliath::Plugin::Latency) initialize(port, config, status, logger)
Called by the framework to initialize the plugin
16 17 18 19 20 21 22 |
# File 'lib/goliath/plugins/latency.rb', line 16 def initialize(port, config, status, logger) @status = status @config = config @logger = logger @last = Time.now.to_f end |
Instance Method Details
- (Object) run
Called automatically to start the plugin
25 26 27 28 29 30 |
# File 'lib/goliath/plugins/latency.rb', line 25 def run EM.add_periodic_timer(1) do @logger.info "LATENCY: #{Time.now.to_f - @last}" @last = Time.now.to_f end end |