Return true if this process is running, false otherwise
# File lib/god/system/process.rb, line 19 def exists? !!::Process.kill(0, @pid) rescue false end
Memory usage in kilobytes (resident set size)
# File lib/god/system/process.rb, line 24 def memory @poller.memory end
Percentage CPU usage
# File lib/god/system/process.rb, line 34 def percent_cpu @poller.percent_cpu end
Percentage memory usage
# File lib/god/system/process.rb, line 29 def percent_memory @poller.percent_memory end
# File lib/god/system/process.rb, line 5 def self.fetch_system_poller @@poller ||= if SlashProcPoller.usable? SlashProcPoller else PortablePoller end end
# File lib/god/system/process.rb, line 13 def initialize(pid) @pid = pid.to_i @poller = self.class.fetch_system_poller.new(@pid) end