Sha256: 78e6686ed69d5a4ca5b126ebf0c5abc0ee59f9db30c8172af7be4dab5b47ee02

Contents?: true

Size: 351 Bytes

Versions: 53

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.cpu_usage(pid).to_f
      end
      
      def check(value)
        value < @below
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 8 rubygems

Version Path
bluepill-0.0.36 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.35 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.34 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.33 lib/bluepill/process_conditions/cpu_usage.rb
wijet-bluepill-0.0.33 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.32 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.31 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.30 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.28 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.27 lib/bluepill/process_conditions/cpu_usage.rb
gvarela-bluepill-0.0.28 lib/bluepill/process_conditions/cpu_usage.rb
gvarela-bluepill-0.0.27 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.26 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.25 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.24 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.23 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.22 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.21 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.20 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.19 lib/bluepill/process_conditions/cpu_usage.rb