class Airbrake::Benchmark

@api public
@since v4.2.4
Benchmark benchmarks Ruby code.

def self.measure

Other tags:
    Yieldreturn: -
def self.measure
  benchmark = new
  yield
  benchmark.stop
  benchmark.duration
end

def initialize

Other tags:
    Since: - v4.3.0
def initialize
  @start = MonotonicTime.time_in_ms
  @duration = 0.0
end

def stop

Returns:
  • (Boolean) - true for the first invocation, false in all other cases

Other tags:
    Since: - v4.3.0
def stop
  return false if @duration > 0.0
  @duration = MonotonicTime.time_in_ms - @start
  true
end