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.
Constant Summary
- @@recent_latency =
0
Class Method Summary (collapse)
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 |
Class Method Details
+ (Object) recent_latency
25 26 27 |
# File 'lib/goliath/plugins/latency.rb', line 25 def self.recent_latency @@recent_latency end |
Instance Method Details
- (Object) run
Called automatically to start the plugin
30 31 32 33 34 35 36 |
# File 'lib/goliath/plugins/latency.rb', line 30 def run EM.add_periodic_timer(1) do @@recent_latency = (Time.now.to_f - @last) @logger.info "LATENCY: #{@@recent_latency}" @last = Time.now.to_f end end |