struct Hardware::PID::Stat
- Hardware::PID::Stat
- Struct
- Value
- Object
Overview
Parse stat initialized at Hadware::PID#stat
pid_stat = Hardware::PID::Stat.new
loop do
sleep 1
p pid_stat.cpu_usage! # => 1.5
end
Defined in:
pid/stat.crConstructors
Instance Method Summary
-
#cmajflt
Returns the "cmajflt" stat field.
-
#cminflt
Returns the "cminflt" stat field.
- #comm
-
#cpu_time(children : Bool = false) : Int32
Returns the CPU time with or without including ones from
children
processes. -
#cpu_usage!(children : Bool = false, current_cpu : CPU = CPU.new) : Float64
Returns the CPU used in percentage.
-
#cstime
Returns the "cstime" stat field.
-
#cutime
Returns the "cutime" stat field.
- #data : Array(String)
-
#flags
Returns the "flags" stat field.
-
#itrealvalue
Returns the "itrealvalue" stat field.
-
#majflt
Returns the "majflt" stat field.
-
#minflt
Returns the "minflt" stat field.
-
#nice
Returns the "nice" stat field.
-
#numthreads
Returns the "numthreads" stat field.
- #parse_stat_file
-
#pgrp
Returns the "pgrp" stat field.
- #pid : Int32
-
#ppid
Generate methods based on stat Returns the "ppid" stat field.
-
#priority
Returns the "priority" stat field.
-
#rss
Returns the "rss" stat field.
-
#session
Returns the "session" stat field.
-
#starttime
Returns the "starttime" stat field.
- #state
-
#stime
Returns the "stime" stat field.
-
#tpgid
Returns the "tpgid" stat field.
-
#tty_nr
Returns the "tty_nr" stat field.
-
#utime
Returns the "utime" stat field.
-
#vsize
Returns the "vsize" stat field.
Constructor Detail
Instance Method Detail
Returns the CPU time with or without including ones from children
processes.
Returns the CPU used in percentage.
pid_stat = Hardware::PID::Stat.new
loop do
sleep 1
p pid_stat.cpu_usage! # => 1.5
end