Module: LoadMonitor
- Defined in:
- lib/load_monitor.rb
Class Method Summary collapse
- .can_increase_load?(max_cpu_load, max_memory_load) ⇒ Boolean
- .cpu_load ⇒ Object
- .memory_load ⇒ Object
- .vendor ⇒ Object
Class Method Details
.can_increase_load?(max_cpu_load, max_memory_load) ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/load_monitor.rb', line 15 def self.can_increase_load?(max_cpu_load, max_memory_load) increment_count = 0 self.load_cycles.times do if self.cpu_load < max_cpu_load && self..memory_load < max_memory_load increment_count += 1 else increment_count -= 2 end sleep(self.load_sleep_time) end # increment_count > 0 ? say("Load normal-Increment") : say("Load high-Decrement") return increment_count > 0 end |
.cpu_load ⇒ Object
7 8 9 |
# File 'lib/load_monitor.rb', line 7 def self.cpu_load vendor.uw_cpuused end |
.memory_load ⇒ Object
11 12 13 |
# File 'lib/load_monitor.rb', line 11 def self.memory_load vendor.uw_memused end |
.vendor ⇒ Object
3 4 5 |
# File 'lib/load_monitor.rb', line 3 def self.vendor UsageWatch end |