class Benchmark::IPSReport

Constants

VERSION

Attributes

ips[R]
ips_sd[R]
iterations[R]
label[R]
measurement_cycle[R]
microseconds[R]

Public Class Methods

new(label, us, iters, ips, ips_sd, cycles) click to toggle source
# File lib/benchmark/ips.rb, line 9
def initialize(label, us, iters, ips, ips_sd, cycles)
  @label = label
  @microseconds = us
  @iterations = iters
  @ips = ips
  @ips_sd = ips_sd
  @measurement_cycle = cycles
end

Public Instance Methods

body() click to toggle source
# File lib/benchmark/ips.rb, line 30
def body
  left = "%10.1f (±%.1f%%) i/s" % [ips, stddev_percentage]
  left.ljust(20) + (" - %10d in %10.6fs" % [@iterations, runtime])
end
display() click to toggle source
# File lib/benchmark/ips.rb, line 43
def display
  $stdout.puts to_s
end
header() click to toggle source
# File lib/benchmark/ips.rb, line 35
def header
  @label.rjust(20)
end
runtime()
Alias for: seconds
seconds() click to toggle source
# File lib/benchmark/ips.rb, line 20
def seconds
  @microseconds.to_f / 1_000_000.0
end
Also aliased as: runtime
stddev_percentage() click to toggle source
# File lib/benchmark/ips.rb, line 24
def stddev_percentage
  100.0 * (@ips_sd.to_f / @ips.to_f)
end
to_s() click to toggle source
# File lib/benchmark/ips.rb, line 39
def to_s
  "#{header} #{body}"
end