Sha256: 3c597559003d0b45298b4ff7609fcfb21e717839ae80d5601b5c6baf2c6823ae

Contents?: true

Size: 335 Bytes

Versions: 4

Compression:

Stored size: 335 Bytes

Contents

module Bluepill
  module ProcessConditions
    class MemUsage < ProcessCondition
      def initialize(options = {})
        @below = options[:below]
      end
      
      def run(pid)
        `ps ux -p #{pid} | tail -1 | awk '{print $5}'`.to_f
      end
      
      def check(value)
        value < @below
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bluepill-0.0.4 lib/bluepill/process_conditions/mem_usage.rb
bluepill-0.0.3 lib/bluepill/process_conditions/mem_usage.rb
bluepill-0.0.2 lib/bluepill/process_conditions/mem_usage.rb
bluepill-0.0.1 lib/bluepill/process_conditions/mem_usage.rb