struct Hardware::Memory

Overview

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

Defined in:

memory.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

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


[View source]

Instance Method Detail

def available #

Returns the available memory in KiloBytes.


[View source]
def meminfo : Hash(String, Int64) #

Returns an Hash from a parsed /proc/meminfo.


[View source]
def percent(used : Bool = true) : Float64 #

Returns either the used/available memory in percentage.


[View source]
def total #

Returns the total memory in KiloBytes.


[View source]
def used #

Returns the memory used in KiloBytes.


[View source]