# -*- 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