Module: Benchmark::BigO

Included in:
Benchmark
Defined in:
lib/benchmark/bigo.rb,
lib/benchmark/bigo/job.rb,
lib/benchmark/bigo/chart.rb,
lib/benchmark/bigo/report.rb,
lib/benchmark/bigo/version.rb

Defined Under Namespace

Classes: Chart, Job, Report, TermPlot, Version

Constant Summary collapse

VERSION =
Version.to_s

Instance Method Summary collapse

Instance Method Details

#bigo {|job| ... } ⇒ Object

Yields:

  • (job)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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