Sha256: 5577c907158dddb7b2c78bffbce1763c2544fbdf3dd74d069dd4e33a3167fda0

Contents?: true

Size: 391 Bytes

Versions: 16

Compression:

Stored size: 391 Bytes

Contents

module ProconBypassMan
  class LoadAgv
    PATH = '/proc/loadavg'

    # @return [[Integer, Integer, Integer]]
    def get
      loadavg = get_proc_loadavg
      loadavg =~ /^([0-9.]+)\s([0-9.]+)\s([0-9.]+)/
      return [$1.to_f, $2.to_f, $3.to_f].join("-")
    rescue Errno::ENOENT
      ""
    end

    private

    def get_proc_loadavg
      File.read('/proc/loadavg')
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/support/load_agv.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/support/load_agv.rb