module Benchmark::BigO

Constants

VERSION

Public Instance Methods

bigo() { |job| ... } click to toggle source
# File lib/benchmark/bigo.rb, line 14
def bigo
  suite = nil

  sync, $stdout.sync = $stdout.sync, true

  if defined? Benchmark::Suite and Suite.current
    suite = Benchmark::Suite.current
  end

  quiet = suite && !suite.quiet?

  job = Job.new({:suite => suite,
                 :quiet => quiet
  })

  yield job

  $stdout.puts "Calculating -------------------------------------" unless quiet

  job.run_warmup

  $stdout.puts "-------------------------------------------------" unless quiet

  job.run
  job.generate_output

  $stdout.sync = sync

  return job.full_report
end