class Benchmark::IPS::Report::Entry

Represents benchmarking code data for Report.

def body

Returns:
  • (String) - Left justified body.
def body
  per_iter = (" (%s/i)" % Helpers.humanize_duration(1_000_000_000 / @stats.central_tendency)).rjust(15)
  case Benchmark::IPS.options[:format]
  when :human
    left = ("%s (±%4.1f%%) i/s" % [Helpers.scale(@stats.central_tendency), @stats.error_percentage]).ljust(20)
    iters = Helpers.scale(@iterations)
    if @show_total_time
      left + per_iter + (" - %s in %10.6fs" % [iters, runtime])
    else
      left + per_iter + (" - %s" % iters)
    end
  else
    left = ("%10.1f (±%.1f%%) i/s" % [@stats.central_tendency, @stats.error_percentage]).ljust(20)
    if @show_total_time
      left + per_iter + (" - %10d in %10.6fs" % [@iterations, runtime])
    else
      left + per_iter + (" - %10d" % @iterations)
    end
  end
end

def display

Print entry to current standard output ($stdout).
def display
  $stdout.puts to_s
end

def error_percentage

Returns:
  • (Float) - +@ips_sd+ in percentage.
def error_percentage
  @stats.error_percentage
end

def header

Returns:
  • (String) - Right justified header (+@label+).
def header
  @label.to_s.rjust(20)
end

def initialize(label, us, iters, stats, cycles)

Parameters:
  • cycles (Integer) -- Number of Cycles.
  • stats (Object) -- Statistics.
  • iters (Integer) -- Iterations.
  • us (Integer) -- Measured time in microsecond.
  • label (#to_s) -- Label of entry.
def initialize(label, us, iters, stats, cycles)
  @label = label
  @microseconds = us
  @iterations = iters
  @stats = stats
  @measurement_cycle = cycles
  @show_total_time = false
end

def ips

Returns:
  • (Float) - number of iterations per second.
def ips
  @stats.central_tendency
end

def ips_sd

Returns:
  • (Float) - standard deviation of iteration per second.
def ips_sd
  @stats.error
end

def samples

def samples
  @stats.samples
end

def seconds

Returns:
  • (Float) - +@microseconds+ in seconds.
def seconds
  @microseconds.to_f / 1_000_000.0
end

def show_total_time!

close to the expected time, so it's suppressed by default.
Typically this value is not significant because it's very
Control if the total time the job took is reported.
def show_total_time!
  @show_total_time = true
end

def to_s

Returns:
  • (String) - Header and body.
def to_s
  "#{header} #{body}"
end