class Bluepill::ProcessConditions::MemUsage

Constants

FORMAT_STR
KB_LABEL
MB
MB_LABEL

Public Class Methods

new(options = {}) click to toggle source
# File lib/bluepill/process_conditions/mem_usage.rb, line 9
def initialize(options = {})
  @below = options[:below]
end

Public Instance Methods

check(value) click to toggle source
# File lib/bluepill/process_conditions/mem_usage.rb, line 18
def check(value)
  value.kilobytes < @below
rescue
  true
end
format_value(value) click to toggle source
# File lib/bluepill/process_conditions/mem_usage.rb, line 24
def format_value(value)
  if value.kilobytes >= MB
    format(FORMAT_STR, (value / 1024).round, MB_LABEL)
  else
    format(FORMAT_STR, value, KB_LABEL)
  end
end
run(pid, include_children) click to toggle source
# File lib/bluepill/process_conditions/mem_usage.rb, line 13
def run(pid, include_children)
  # rss is on the 5th col
  System.memory_usage(pid, include_children).to_f
end