class Benchmark::IPS::Report::Entry
Represents benchmarking code data for Report.
def body
-
(String)
- Left justified body.
def body case Benchmark::IPS.options[:format] when :human left = "%s (±%4.1f%%) i/s" % [Helpers.scale(ips), stddev_percentage] iters = Helpers.scale(@iterations) if @show_total_time left.ljust(20) + (" - %s in %10.6fs" % [iters, runtime]) else left.ljust(20) + (" - %s" % iters) end else left = "%10.1f (±%.1f%%) i/s" % [ips, stddev_percentage] if @show_total_time left.ljust(20) + (" - %10d in %10.6fs" % [@iterations, runtime]) else left.ljust(20) + (" - %10d" % @iterations) end end end
def display
def display $stdout.puts to_s end
def header
-
(String)
- Right justified header (+@label+).
def header @label.to_s.rjust(20) end
def initialize(label, us, iters, ips, ips_sd, cycles)
-
cycles
(Integer
) -- Number of Cycles. -
ips_sd
(Float
) -- Standard deviation of iterations per second. -
ips
(Float
) -- Iterations per second. -
iters
(Integer
) -- Iterations. -
us
(Integer
) -- Measured time in microsecond. -
label
(#to_s
) -- Label of entry.
def initialize(label, us, iters, ips, ips_sd, cycles) @label = label @microseconds = us @iterations = iters @ips = ips @ips_sd = ips_sd @measurement_cycle = cycles @show_total_time = false end
def seconds
-
(Float)
- +@microseconds+ in seconds.
def seconds @microseconds.to_f / 1_000_000.0 end
def show_total_time!
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 stddev_percentage
-
(Float)
- +@ips_sd+ in percentage.
def stddev_percentage 100.0 * (@ips_sd.to_f / @ips.to_f) end
def to_s
-
(String)
- Header and body.
def to_s "#{header} #{body}" end