Class: ReReplay::MemoryMonitor

Inherits:
Object
  • Object
show all
Defined in:
lib/rereplay/monitors/memory_monitor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemoryMonitor

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

#intervalObject

Returns the value of attribute interval.



5
6
7
# File 'lib/rereplay/monitors/memory_monitor.rb', line 5

def interval
  @interval
end

#resultsObject (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