class Benchmark::IPS::Report
Perform operations like add new entry, run comparison between entries.
Report contains benchmarking entries.
def add_entry label, microseconds, iters, ips, ips_sd, measurement_cycle
-
(Report::Entry)
- Last added entry.
Parameters:
-
measurement_cycle
(Integer
) -- Number of cycles. -
ips_sd
(Float
) -- Standard deviation of iterations per second. -
ips
(Float
) -- Average Iterations per second. -
iters
(Integer
) -- Iterations. -
microseconds
(Integer
) -- Measured time in microsecond. -
label
(String
) -- Entry label.
def add_entry label, microseconds, iters, ips, ips_sd, measurement_cycle entry = Entry.new(label, microseconds, iters, ips, ips_sd, measurement_cycle) @entries.delete_if { |e| e.label == label } @entries << entry entry end
def data
-
(Array
- Array] Array of hashes with :label, :ips, :stddev) ] Array of hashes with :label, :ips, :stddev
def data @data ||= @entries.collect do |entry| { :name => entry.label, :ips => entry.ips, :stddev => entry.ips_sd } end end
def generate_json(path)
-
path
(String
) -- path to generate json.
def generate_json(path) File.open path, "w" do |f| require "json" f.write JSON.pretty_generate(data) end end
def initialize
def initialize @entries = [] @data = nil end
def run_comparison
def run_comparison Benchmark.compare(*@entries) end