Class: Memtf::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/memtf/runner.rb

Overview

Encapsulates the multiple steps required to accomplish Memtf analysis and reporting.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Runner

Returns a new instance of Runner.



14
15
16
17
# File 'lib/memtf/runner.rb', line 14

def initialize(options={})
	@group   = options.delete(:group) || Time.now.to_i
	@options = options
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



4
5
6
# File 'lib/memtf/runner.rb', line 4

def group
  @group
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/memtf/runner.rb', line 4

def options
  @options
end

#reportObject (readonly)

Returns the value of attribute report.



4
5
6
# File 'lib/memtf/runner.rb', line 4

def report
  @report
end

Class Method Details

.run(stage, options = {}) ⇒ Object

Run the Memtf analysis and reporting.

Parameters:

  • stage (String)
  • options (Hash) (defaults to: {})


10
11
12
# File 'lib/memtf/runner.rb', line 10

def self.run(stage, options={})
	new(options).run(stage)
end

Instance Method Details

#run(stage) ⇒ Memtf::Runner

Run the Memtf analysis and reporting.

Parameters:

  • stage (String)

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/memtf/runner.rb', line 23

def run(stage)
	analysis = Memtf::Analyzer.analyze(options)
   Memtf::Persistance.save(stage, group, analysis)
   analysis = nil

   if stage == Memtf::STOP
     @report = Memtf::Reporter.report(group)
     puts @report
   end

	self
end