Class: MemoryWatch
- Inherits:
-
Object
- Object
- MemoryWatch
- Defined in:
- lib/memory_watch.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#callback_message ⇒ Object
Returns the value of attribute callback_message.
-
#delay ⇒ Object
Returns the value of attribute delay.
-
#high_water_mb ⇒ Object
Returns the value of attribute high_water_mb.
-
#high_water_pids ⇒ Object
Returns the value of attribute high_water_pids.
-
#num_cycles ⇒ Object
Returns the value of attribute num_cycles.
-
#num_over_marks ⇒ Object
Returns the value of attribute num_over_marks.
-
#pids ⇒ Object
Returns the value of attribute pids.
-
#watch_string ⇒ Object
Returns the value of attribute watch_string.
Instance Method Summary collapse
- #cycle ⇒ Object
-
#initialize(options) ⇒ MemoryWatch
constructor
A new instance of MemoryWatch.
Constructor Details
#initialize(options) ⇒ MemoryWatch
Returns a new instance of MemoryWatch.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/memory_watch.rb', line 5 def initialize() self.callback = [:callback] || lambda {|pid| p pid} self. = ([:callback_message] || "Callback Triggered").strip self.watch_string = Regexp.escape(([:watch] || "this poem is a pomme").strip) self.delay = [:delay] || 60 self.num_cycles = [:num_cycles] || 3 self.num_over_marks = [:num_over_marks] || 2 self.high_water_mb = [:high_water_mb] || 700 self.high_water_pids = {} end |
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def callback @callback end |
#callback_message ⇒ Object
Returns the value of attribute callback_message.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def end |
#delay ⇒ Object
Returns the value of attribute delay.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def delay @delay end |
#high_water_mb ⇒ Object
Returns the value of attribute high_water_mb.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def high_water_mb @high_water_mb end |
#high_water_pids ⇒ Object
Returns the value of attribute high_water_pids.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def high_water_pids @high_water_pids end |
#num_cycles ⇒ Object
Returns the value of attribute num_cycles.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def num_cycles @num_cycles end |
#num_over_marks ⇒ Object
Returns the value of attribute num_over_marks.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def num_over_marks @num_over_marks end |
#pids ⇒ Object
Returns the value of attribute pids.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def pids @pids end |
#watch_string ⇒ Object
Returns the value of attribute watch_string.
2 3 4 |
# File 'lib/memory_watch.rb', line 2 def watch_string @watch_string end |
Instance Method Details
#cycle ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/memory_watch.rb', line 16 def cycle self.num_cycles.times do _check_pids sleep self.delay end _trigger_callback end |