class God::System::Process
Public Class Methods
fetch_system_poller()
click to toggle source
# File lib/god/system/process.rb, line 5 def self.fetch_system_poller @@poller ||= if SlashProcPoller.usable? SlashProcPoller else PortablePoller end end
new(pid)
click to toggle source
# File lib/god/system/process.rb, line 13 def initialize(pid) @pid = pid.to_i @poller = self.class.fetch_system_poller.new(@pid) end
Public Instance Methods
exists?()
click to toggle source
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()
click to toggle source
Memory usage in kilobytes (resident set size)
# File lib/god/system/process.rb, line 24 def memory @poller.memory end
percent_cpu()
click to toggle source
Percentage CPU usage
# File lib/god/system/process.rb, line 34 def percent_cpu @poller.percent_cpu end
percent_memory()
click to toggle source
Percentage memory usage
# File lib/god/system/process.rb, line 29 def percent_memory @poller.percent_memory end
Private Instance Methods
fetch_system_poller()
click to toggle source
# File lib/god/system/process.rb, line 40 def fetch_system_poller if SlashProcPoller.usable? SlashProcPoller else PortablePoller end end