Class: StressReporter::Checker

Inherits:
Object
  • Object
show all
Defined in:
lib/stress_reporter/checker.rb

Overview

This class has the knowledge of when to run the reporting. It may well become a strategy, or a DSL parser; for the time being the check is very crude, just check last minute load average

Constant Summary collapse

LIMIT =

This limit is going to be passed in as a command line arg Defaults to 1.0

ARGV.empty? ? 1 : ARGV[0].to_f
@@load_average =

starts at 0.0

0.0

Class Method Summary collapse

Class Method Details

.go?Boolean

Returns true if limit exceeded. Sets @@load_average

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/stress_reporter/checker.rb', line 15

def self.go?
  @@load_average = Sys::CPU.load_avg[0].to_f
  @@load_average > LIMIT
end

.load_averageObject

Returns last load average



21
22
23
# File 'lib/stress_reporter/checker.rb', line 21

def self.load_average
  @@load_average
end