Sha256: 530d278c6942a39bcccfa848333fef4992e529b96ba23ae1e9b2c5013a59f8d9
Contents?: true
Size: 813 Bytes
Versions: 50
Compression:
Stored size: 813 Bytes
Contents
module God module System class Process def initialize(pid) @pid = pid.to_i @poller = fetch_system_poller.new(@pid) end # Return true if this process is running, false otherwise def exists? !!::Process.kill(0, @pid) rescue false end # Memory usage in kilobytes (resident set size) def memory @poller.memory end # Percentage memory usage def percent_memory @poller.percent_memory end # Percentage CPU usage def percent_cpu @poller.percent_cpu end private def fetch_system_poller if SlashProcPoller.usable? SlashProcPoller else PortablePoller end end end end end
Version data entries
50 entries across 50 versions & 19 rubygems