class Goliath::Plugin::Latency
plugin Goliath::Plugin::Latency
@example
Report latency information about the EventMachine reactor to the log file.
def self.recent_latency
def self.recent_latency @@recent_latency end
def initialize(port, config, status, logger)
-
(Goliath::Plugin::Latency)
- An instance of the Goliath::Plugin::Latency plugin
Parameters:
-
logger
(Log4R::Logger
) -- The logger -
status
(Hash
) -- A status hash -
config
(Hash
) -- The server configuration data -
port
(Integer
) -- Unused
def initialize(port, config, status, logger) @status = status @config = config @logger = logger @last = Time.now.to_f end
def run
def run EM.add_periodic_timer(LATENCY_TIMING) do @@recent_latency = ((Time.now.to_f - @last) - LATENCY_TIMING) @logger.info "LATENCY: #{(@@recent_latency * 1000)} ms" @last = Time.now.to_f end end