Class: Host::LoadAverage

Inherits:
Object
  • Object
show all
Defined in:
lib/host/load_average.rb

Overview

Can provide the information on load average in the last 1 minute, 5 minutes and 15 minutes, as in /proc/loadavg on Linux systems.

Also, different information can be provided, depending on your operating system. On Linux, this class can also retrieve the number of running process (and the total number of processes).

Help us support your operating system as well!

Usage:

# Supposing we are in a Linux box:
Host::LoadAverage.on_last(1)  #=> 0.2
Host::LoadAverage.on_last(5)  #=> 0.1
Host::LoadAverage.on_last(15) #=> 0.5

Host::LoadAverage.running_processes #=> 4
Host::LoadAverage.total_processes   #=> 312

Class Method Summary collapse

Class Method Details

.load_infoObject



27
28
29
# File 'lib/host/load_average.rb', line 27

def load_info
  @info ||= []
end