Class: Benchmark::IPS::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/benchmark/ips/report.rb

Overview

Report contains benchamrking entries. Perform operations like add new entry, run comparison between entries.

Defined Under Namespace

Classes: Entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReport

Instantiate the Report.



125
126
127
# File 'lib/benchmark/ips/report.rb', line 125

def initialize
  @entries = []
end

Instance Attribute Details

#entriesArray<Entry> (readonly)

Entry to represent each benchamarked code in Report.

Returns:

  • (Array<Entry>)

    Entries in Report.



122
123
124
# File 'lib/benchmark/ips/report.rb', line 122

def entries
  @entries
end

Instance Method Details

#add_entry(label, microseconds, iters, ips, ips_sd, measurement_cycle) ⇒ Entry

Add entry to report.

Parameters:

  • label (String)

    Entry label.

  • microseconds (Integer)

    Measured time in microsecond.

  • iters (Integer)

    Iterations.

  • ips (Float)

    Average Iterations per second.

  • ips_sd (Float)

    Standard deviation of iterations per second.

  • measurement_cycle (Integer)

    Number of cycles.

Returns:

  • (Entry)

    Last added entry.



137
138
139
140
# File 'lib/benchmark/ips/report.rb', line 137

def add_entry label, microseconds, iters, ips, ips_sd, measurement_cycle
  @entries << Entry.new(label, microseconds, iters, ips, ips_sd, measurement_cycle)
  @entries.last
end

#run_comparisonObject

Run comparison of entries.



143
144
145
# File 'lib/benchmark/ips/report.rb', line 143

def run_comparison
  Benchmark.compare(*@entries)
end