Hardware::PID
Inherits Struct / Value / Object
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
Class methods
get_pids(executable : String, & : Int64 -> )
Yield each pids corresponding to a given executable name.
Instance methods
exists?
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