Benchmark::Report (Class)

In: benchmark.rb
Parent: Object

This class is used by the Benchmark.benchmark and Benchmark.bm methods. It is of little direct interest to the user.

Methods

item   new   report  

Public Class methods

Returns an initialized Report instance. Usually, one doesn’t call this method directly, as new Report objects are created by the benchmark and bm methods. width and fmtstr are the label offset and format string used by Tms#format.

[Source]

# File benchmark.rb, line 401
    def initialize(width = 0, fmtstr = nil)
      @width, @fmtstr = width, fmtstr
    end

Public Instance methods

Prints the label and measured time for the block, formatted by fmt. See Tms#format for the formatting rules.

[Source]

# File benchmark.rb, line 410
    def item(label = "", *fmt, &blk) # :yield:

      print label.ljust(@width)
      res = Benchmark::measure(&blk)
      print res.format(@fmtstr, *fmt)
      res
    end
report(label = "", *fmt)

Alias for item

[Validate]