Class: EventedBluepill::ProcessConditions::CpuUsage
- Inherits:
-
ProcessCondition
- Object
- Coolio::TimerWatcher
- ProcessCondition
- EventedBluepill::ProcessConditions::CpuUsage
- Defined in:
- lib/evented_bluepill/process_conditions/cpu_usage.rb
Instance Attribute Summary
Attributes inherited from ProcessCondition
#every, #fires, #logger, #name, #process, #process_condition
Instance Method Summary collapse
- #check(value) ⇒ Object
-
#initialize(name, process, options = {}) ⇒ CpuUsage
constructor
A new instance of CpuUsage.
- #run ⇒ Object
Methods inherited from ProcessCondition
#clear_history!, #format_value, #to_s
Constructor Details
#initialize(name, process, options = {}) ⇒ CpuUsage
Returns a new instance of CpuUsage.
9 10 11 12 13 |
# File 'lib/evented_bluepill/process_conditions/cpu_usage.rb', line 9 def initialize(name, process, = {}) @below = [:below] super end |
Instance Method Details
#check(value) ⇒ Object
20 21 22 |
# File 'lib/evented_bluepill/process_conditions/cpu_usage.rb', line 20 def check(value) value < @below end |
#run ⇒ Object
15 16 17 18 |
# File 'lib/evented_bluepill/process_conditions/cpu_usage.rb', line 15 def run # third col in the ps axu output EventedBluepill::System.cpu_usage(process.actual_pid).to_f end |