Class: Benchmark::Memory::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/benchmark/memory/report.rb,
lib/benchmark/memory/report/entry.rb,
lib/benchmark/memory/report/comparison.rb

Overview

Hold the results of a set of benchmarks.

Defined Under Namespace

Classes: Comparison, Entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Instantiate a report to hold entries of tasks and measurements.



11
12
13
# File 'lib/benchmark/memory/report.rb', line 11

def initialize
  @entries = []
end

Instance Attribute Details

#entriesArray<Entry> (readonly)

Returns The entries in the report.

Returns:

  • (Array<Entry>)

    The entries in the report.



16
17
18
# File 'lib/benchmark/memory/report.rb', line 16

def entries
  @entries
end

Instance Method Details

#add_entry(task, measurement) ⇒ Entry

Add an entry to the report.

Parameters:

  • task (Job::Task)

    The task to report about.

  • measurement (Measurement)

    The measurements from the task.

Returns:

  • (Entry)

    the newly created entry.



24
25
26
27
28
# File 'lib/benchmark/memory/report.rb', line 24

def add_entry(task, measurement)
  entry = Entry.new(task.label, measurement)
  entries.push(entry)
  entry
end

#comparable?Boolean

Return true if the report is comparable.

Returns:

  • (Boolean)


33
34
35
# File 'lib/benchmark/memory/report.rb', line 33

def comparable?
  comparison.possible?
end

#comparisonComparison

Compare the entries within a report.

Returns:



40
41
42
# File 'lib/benchmark/memory/report.rb', line 40

def comparison
  @comparison ||= Comparison.new(entries)
end