Sha256: 075c98195af17222a7277fbe0792432861439a30e4c8be3373564ad95e8da4d2

Contents?: true

Size: 366 Bytes

Versions: 1

Compression:

Stored size: 366 Bytes

Contents

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

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

1 entries across 1 versions & 1 rubygems

Version Path
evented_bluepill-0.0.47 lib/bluepill/process_conditions/cpu_usage.rb