Class: Mool::System
Instance Attribute Summary collapse
-
#current_loadavg ⇒ Object
Returns the value of attribute current_loadavg.
-
#kernel ⇒ Object
Returns the value of attribute kernel.
-
#last_15min_loadavg ⇒ Object
Returns the value of attribute last_15min_loadavg.
-
#last_5min_loadavg ⇒ Object
Returns the value of attribute last_5min_loadavg.
-
#last_pid_process_created ⇒ Object
Returns the value of attribute last_pid_process_created.
-
#thread_entities_exec ⇒ Object
Returns the value of attribute thread_entities_exec.
-
#total_thread_entities ⇒ Object
Returns the value of attribute total_thread_entities.
-
#uptime_day ⇒ Object
Returns the value of attribute uptime_day.
-
#uptime_hour ⇒ Object
Returns the value of attribute uptime_hour.
-
#uptime_minute ⇒ Object
Returns the value of attribute uptime_minute.
-
#uptime_second ⇒ Object
Returns the value of attribute uptime_second.
Instance Method Summary collapse
-
#initialize ⇒ System
constructor
A new instance of System.
- #kernel_version ⇒ Object
- #load_average ⇒ Object
- #uptime ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ System
Returns a new instance of System.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mool/system.rb', line 15 def initialize @kernel = Mool::Command.uname load_avg = Mool::Command.loadavg.split(' ') @current_loadavg = load_avg[0].to_f @last_5min_loadavg = load_avg[1].to_f @last_15min_loadavg = load_avg[2].to_f # Currently executing kernel scheduling entities @thread_entities_exec = load_avg[3].split('/').first.to_i # Number of kernel scheduling entities that currently exist on the system @total_thread_entities = load_avg[3].split('/').last.to_i @last_pid_process_created = load_avg[4].to_i time = Mool::Command.uptime.split(' ').first.to_f mm, ss = time.divmod(60) hh, mm = mm.divmod(60) dd, hh = hh.divmod(24) @uptime_day = dd.to_i @uptime_hour = hh.to_i @uptime_minute = mm.to_i @uptime_second = ss.to_i end |
Instance Attribute Details
#current_loadavg ⇒ Object
Returns the value of attribute current_loadavg.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def current_loadavg @current_loadavg end |
#kernel ⇒ Object
Returns the value of attribute kernel.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def kernel @kernel end |
#last_15min_loadavg ⇒ Object
Returns the value of attribute last_15min_loadavg.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def last_15min_loadavg @last_15min_loadavg end |
#last_5min_loadavg ⇒ Object
Returns the value of attribute last_5min_loadavg.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def last_5min_loadavg @last_5min_loadavg end |
#last_pid_process_created ⇒ Object
Returns the value of attribute last_pid_process_created.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def last_pid_process_created @last_pid_process_created end |
#thread_entities_exec ⇒ Object
Returns the value of attribute thread_entities_exec.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def thread_entities_exec @thread_entities_exec end |
#total_thread_entities ⇒ Object
Returns the value of attribute total_thread_entities.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def total_thread_entities @total_thread_entities end |
#uptime_day ⇒ Object
Returns the value of attribute uptime_day.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def uptime_day @uptime_day end |
#uptime_hour ⇒ Object
Returns the value of attribute uptime_hour.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def uptime_hour @uptime_hour end |
#uptime_minute ⇒ Object
Returns the value of attribute uptime_minute.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def uptime_minute @uptime_minute end |
#uptime_second ⇒ Object
Returns the value of attribute uptime_second.
3 4 5 |
# File 'lib/mool/system.rb', line 3 def uptime_second @uptime_second end |
Instance Method Details
#kernel_version ⇒ Object
56 57 58 |
# File 'lib/mool/system.rb', line 56 def kernel_version @kernel end |
#load_average ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mool/system.rb', line 36 def load_average { current_loadavg: @current_loadavg, last_5min_loadavg: @last_5min_loadavg, last_15min_loadavg: @last_15min_loadavg, thread_entities_exec: @thread_entities_exec, total_thread_entities: @total_thread_entities, last_pid_process_created: @last_pid_process_created } end |
#uptime ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/mool/system.rb', line 47 def uptime { day: @uptime_day, hour: @uptime_hour, minute: @uptime_minute, second: @uptime_second } end |