module Vidibus::Sysinfo::Load
Returns system load, divided by number of CPU cores.
Calls `uptime`
Public Class Methods
command()
click to toggle source
# File lib/vidibus/sysinfo/load.rb, line 20 def command "uptime" end
parse(output)
click to toggle source
# File lib/vidibus/sysinfo/load.rb, line 24 def parse(output) number = /\s+(\d+(?:\.\d+)?)/ if output.match(/load average:#{number},#{number},#{number}/) one = $1.to_f five = $2.to_f fifteen = $3.to_f cpus = System.call[:cpus] Result.new({ one: round(one/cpus), five: round(five/cpus), fifteen: round(fifteen/cpus) }) end end