struct Hardware::CPU
- Hardware::CPU
- Struct
- Value
- Object
Overview
CPU related informations of your system.
cpu = Hardware::CPU.new
loop do
sleep 1
cpu.used.to_i # => 17
end
Defined in:
hardware/cpu.crConstructors
-
.new
Creates a new
Hardware::CPUbased on the current memory state.
Class Method Summary
-
.previous_info : NamedTuple(used: Int32, idle: Int32, total: Int32)
Returns the previous used, idle and total CPU time.
-
.previous_info=(previous_info : NamedTuple(used: Int32, idle: Int32, total: Int32))
Returns the previous used, idle and total CPU time.
Instance Method Summary
-
#guest : Int32
Returns the "guest" field of
#stat. -
#guest_nice : Int32
Returns the "guest_nice" field of
#stat. -
#idle : Int32
Returns the "idle" field of
#stat. -
#info : NamedTuple(used: Int32, idle: Int32, total: Int32)
Returns the current used, idle and total CPU time.
-
#iowait : Int32
Returns the "iowait" field of
#stat. -
#irq : Int32
Returns the "irq" field of
#stat. -
#nice : Int32
Returns the "nice" field of
#stat. -
#softirq : Int32
Returns the "softirq" field of
#stat. -
#stat : Array(Int32)
Returns a parsed
/proc/stat. -
#steal : Int32
Returns the "steal" field of
#stat. -
#system : Int32
Returns the "system" field of
#stat. -
#used(update = true) : Float32
Returns the CPU used in percentage based on
.previous_info. -
#user : Int32
Returns the "user" field of
#stat.
Constructor Detail
Class Method Detail
Returns the previous used, idle and total CPU time. Used to store the previous CPU time informations to calculate the percentage in.used.
Returns the previous used, idle and total CPU time. Used to store the previous CPU time informations to calculate the percentage in.used.
Instance Method Detail
Returns the current used, idle and total CPU time.