4 class MemoryUsage < ProcessCondition
5 attr_accessor :above, :times
16 if self.times.kind_of?(Integer)
17 self.times = [self.times, self.times]
20 @timeline = Timeline.new(self.times[1])
25 valid = complain("You must specify the 'above' attribute for :memory_usage") if self.above.nil?
30 return false unless super
31 pid = File.open(self.pid_file).read.strip
32 process = System::Process.new(pid)
33 @timeline.push(process.memory)
34 if @timeline.select { |x| x > self.above }.size < self.times.first