Class: MoolLoadAverage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMoolLoadAverage

Returns a new instance of MoolLoadAverage.



4
5
6
7
8
9
10
11
12
# File 'lib/mool/load_average.rb', line 4

def initialize
  result = File.read("/proc/loadavg").chomp.split(" ")
  @current_loadavg          = result[0].to_f
  @last_5min_loadavg        = result[1].to_f
  @last_15min_loadavg       = result[2].to_f
  @thread_entities_exec     = result[3].split("/").first.to_i # Currently executing kernel scheduling entities
  @total_thread_entities    = result[3].split("/").last.to_i # Number of kernel scheduling entities that currently exist on the system
  @last_pid_process_created = result[4].to_i
end

Instance Attribute Details

#current_loadavgObject (readonly)

Returns the value of attribute current_loadavg.



2
3
4
# File 'lib/mool/load_average.rb', line 2

def current_loadavg
  @current_loadavg
end

#last_15min_loadavgObject (readonly)

Returns the value of attribute last_15min_loadavg.



2
3
4
# File 'lib/mool/load_average.rb', line 2

def last_15min_loadavg
  @last_15min_loadavg
end

#last_5min_loadavgObject (readonly)

Returns the value of attribute last_5min_loadavg.



2
3
4
# File 'lib/mool/load_average.rb', line 2

def last_5min_loadavg
  @last_5min_loadavg
end

#last_pid_process_createdObject (readonly)

Returns the value of attribute last_pid_process_created.



2
3
4
# File 'lib/mool/load_average.rb', line 2

def last_pid_process_created
  @last_pid_process_created
end

#thread_entities_execObject (readonly)

Returns the value of attribute thread_entities_exec.



2
3
4
# File 'lib/mool/load_average.rb', line 2

def thread_entities_exec
  @thread_entities_exec
end

#total_thread_entitiesObject (readonly)

Returns the value of attribute total_thread_entities.



2
3
4
# File 'lib/mool/load_average.rb', line 2

def total_thread_entities
  @total_thread_entities
end