All informations related to the Processes running on your sytem, defined by Process IDentifiers.
pid = Hardware::PID.new # Default is Process.pid
app = Hardware::PID.new "firefox" # Take the first matching PID
Constructors
Creates a new Hardware::PID.
SourceCreates a new Hardware::PID by finding the executable's pid.
SourceClass methods
each
Yields a Hardware::PID for each PID present on the system.
SourceYield each pids corresponding to a given executable name.
SourceInstance methods
cmdline
Returns /proc/``#pid``/cmdline.
Sourcecommand
Returns a String representation of /proc/``#pid``/cmdline.
Sourceexe
Returns /proc/``#pid``/exe if readable.
Sourcememory
Returns the actual memory used by the process.
Sourcename
Returns the PID name based on #exe or #cmdline.
Sourcenet
Returns Hardware::Net for #pid
Sourcestat(cpu : CPU | Nil = CPU.new) : Stat
Returns a parsed /proc/``#pid``/stat.
Have CPU information of the process.
pid_stat = Hardware::PID.new.stat
loop do
sleep 1
p pid_stat.cpu_usage! # => 1.5
end
Sourcestatm
Returns a parsed /proc/``#pid``/statm.
Sourcestatus
Returns a parsed /proc/``#pid``/status.
Source