Sha256: f42b119e848792a5595b7b5296ec3fc08b3112a190606805aea3494a3663009e

Contents?: true

Size: 402 Bytes

Versions: 11

Compression:

Stored size: 402 Bytes

Contents

# -*- encoding: utf-8 -*-
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

11 entries across 11 versions & 2 rubygems

Version Path
cloud66-bluepill-0.0.64 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.68 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.67 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.66 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.65 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.64 lib/bluepill/process_conditions/cpu_usage.rb
cloud66-bluepill-0.0.63 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.63 lib/bluepill/process_conditions/cpu_usage.rb
cloud66-bluepill-0.0.62 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.62 lib/bluepill/process_conditions/cpu_usage.rb
bluepill-0.0.61 lib/bluepill/process_conditions/cpu_usage.rb