Class: ReReplay::MemoryMonitor
- Inherits:
-
Object
- Object
- ReReplay::MemoryMonitor
- Defined in:
- lib/rereplay/monitors/memory_monitor.rb
Instance Attribute Summary collapse
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize ⇒ MemoryMonitor
constructor
A new instance of MemoryMonitor.
- #tick(time) ⇒ Object
Constructor Details
#initialize ⇒ MemoryMonitor
Returns a new instance of MemoryMonitor.
7 8 9 |
# File 'lib/rereplay/monitors/memory_monitor.rb', line 7 def initialize @results = [] end |
Instance Attribute Details
#interval ⇒ Object
Returns the value of attribute interval.
5 6 7 |
# File 'lib/rereplay/monitors/memory_monitor.rb', line 5 def interval @interval end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
4 5 6 |
# File 'lib/rereplay/monitors/memory_monitor.rb', line 4 def results @results end |
Instance Method Details
#tick(time) ⇒ Object
10 11 12 13 14 |
# File 'lib/rereplay/monitors/memory_monitor.rb', line 10 def tick(time) # http://laurelfan.com/2008/1/15/ruby-memory-usage memory_usage = `ps -o rss= -p #{Process.pid}`.to_i @results << [time, memory_usage] end |