# File lib/god/conditions/cpu_usage.rb, line 59 def test return false unless File.exist?(self.watch.pid_file) pid = File.read(self.watch.pid_file).strip process = System::Process.new(pid) @timeline.push(process.percent_cpu) history = "[" + @timeline.map { |x| "#{x > self.above ? '*' : ''}#{x}%%" }.join(", ") + "]" if @timeline.select { |x| x > self.above }.size >= self.times.first self.info = "cpu out of bounds #{history}" return true else self.info = "cpu within bounds #{history}" return false end end