Sha256: 8b06217f3be221ea261d06687d51a1561865e00ed85cfe0cedf9dd90924ad3c8

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'evented_bluepill/process_conditions/process_condition'
require 'evented_bluepill/system'

module EventedBluepill
  module ProcessConditions
    class CpuUsage < ProcessCondition
      def initialize(name, process, options = {})
        @below = options[:below]

        super
      end

      def run
        # third col in the ps axu output
        EventedBluepill::System.cpu_usage(process.actual_pid).to_f
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
evented_bluepill-0.0.52 lib/evented_bluepill/process_conditions/cpu_usage.rb
evented_bluepill-0.0.51 lib/evented_bluepill/process_conditions/cpu_usage.rb
evented_bluepill-0.0.50 lib/evented_bluepill/process_conditions/cpu_usage.rb