Sha256: ce9153d4335693ff76ad83a7fc42cb8ff17adf0cd155025c6788bc9d0c125a55
Contents?: true
Size: 702 Bytes
Versions: 3
Compression:
Stored size: 702 Bytes
Contents
module Bluepill module ProcessConditions class MemUsage < ProcessCondition MB = 1024**2 FORMAT_STR = '%d%s' MB_LABEL = 'MB' KB_LABEL = 'KB' def initialize(options = {}) @below = options[:below] end def run(pid, include_children) # rss is on the 5th col System.memory_usage(pid, include_children).to_f end def check(value) value.kilobytes < @below rescue true end 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 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bluepill-0.1.2 | lib/bluepill/process_conditions/mem_usage.rb |
bluepill-0.1.1 | lib/bluepill/process_conditions/mem_usage.rb |
bluepill-0.0.70 | lib/bluepill/process_conditions/mem_usage.rb |