struct

Hardware::Memory

Inherits Struct / Value / Object

Memory related informations of your system.

Most values are in kB, except HugePages ones.

memory = Hardware::Memory.new
memory.used         # => 2731404
memory.percent.to_i # => 32

Constructors

new

Creates a new Hardware::Memory based on the current memory state.

Source

Instance methods

available

Returns the available memory in KiloBytes.

Source
meminfo

Returns an Hash from a parsed /proc/meminfo.

Source
percent(used : Bool = true) : Float64

Returns either the used/available memory in percentage.

Source
total

Returns the total memory in KiloBytes.

Source
used

Returns the memory used in KiloBytes.

Source