module ProconBypassMan::IOMonitor

Public Class Methods

new(label: ) click to toggle source
# File lib/procon_bypass_man/io_monitor.rb, line 38
def self.new(label: )
  counter = Counter.new(label: label)
  @@list << counter
  counter
end
reset!() click to toggle source
# File lib/procon_bypass_man/io_monitor.rb, line 75
def self.reset!
  @@list = []
end
start!() click to toggle source

ここで集計する

# File lib/procon_bypass_man/io_monitor.rb, line 50
def self.start!
  Thread.start do
    max_output_length = 0
    loop do
      list = @@list.dup
      unless list.all? { |x| x&.previous_table.is_a?(Hash) }
        sleep 0.5
        next
      end

      line = list.map { |counter|
        "#{counter.label}(#{counter.formated_previous_table})"
      }.join(", ")
      max_output_length = line.length
      sleep 0.7
      print "\r"
      print " " * max_output_length
      print "\r"
      print line
      ProconBypassMan.logger.debug { line }
      break if $will_terminate_token
    end
  end
end
targets() click to toggle source

@return [Array<Counter>]

# File lib/procon_bypass_man/io_monitor.rb, line 45
def self.targets
  @@list
end