Sha256: 1033eec0274bd2e456c3cea8c9026fd934b1e69bdf0a3730e2ac6f569cfc4fcd

Contents?: true

Size: 376 Bytes

Versions: 5

Compression:

Stored size: 376 Bytes

Contents

module Bluepill
  module ProcessConditions
    class CpuUsage < ProcessCondition
      def initialize(options = {})
        @below = options[:below]
      end

      def run(pid, include_children)
        # third col in the ps axu output
        System.cpu_usage(pid, include_children).to_f
      end

      def check(value)
        value < @below
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bluepill-0.1.3 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.1.2 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.1.1 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.70 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.69 lib/bluepill/process_conditions/cpu_usage.rb