lib/bluepill/process_conditions/cpu_usage.rb in bluepill-0.0.46 vs lib/bluepill/process_conditions/cpu_usage.rb in bluepill-0.0.47
- old
+ new
@@ -1,16 +1,17 @@
+# -*- 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
\ No newline at end of file