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 can be passed in as a command line arg

Defaults to 1.0

ARGV.empty? ? 1.0 : 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)


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

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

.load_averageFloat

Returns last checked load average

Returns:

  • (Float)


23
24
25
# File 'lib/stress_reporter/checker.rb', line 23

def self.load_average
  @@load_average
end