Sha256: 492b7d0dfbfe1d9f6be48dad4f932ec38700abb03ab70e95415ded0e92a3342b

Contents?: true

Size: 351 Bytes

Versions: 1

Compression:

Stored size: 351 Bytes

Contents

module Bluepill
  module ProcessConditions
    class CpuUsage < ProcessCondition
      def initialize(options = {})
        @below = options[:below]
      end
      
      def run(pid)
        # third col in the ps axu output
        System.ps_axu[pid][2].to_f
      end
      
      def check(value)
        value < @below
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bluepill-0.0.5 lib/bluepill/process_conditions/cpu_usage.rb