Module: Benchmark::IPS

Included in:
Benchmark
Defined in:
lib/benchmark/ips.rb,
lib/benchmark/ips/job.rb,
lib/benchmark/ips/report.rb

Defined Under Namespace

Classes: Job, Report

Constant Summary collapse

VERSION =
"2.0.0"
CODENAME =
"Springtime Hummingbird Dance"

Instance Method Summary collapse

Instance Method Details

#ips(time = nil, warmup = nil) {|job| ... } ⇒ Object

Yields:

  • (job)


12
13
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
44
45
46
47
48
49
50
# File 'lib/benchmark/ips.rb', line 12

def ips(time=nil, warmup=nil)
  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
  })

  job_opts = {}
  job_opts[:time] = time unless time.nil?
  job_opts[:warmup] = warmup unless warmup.nil?

  job.config job_opts

  yield job

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

  job.run_warmup

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

  job.run

  $stdout.sync = sync

  if job.compare?
    job.run_comparison
  end

  return job.full_report
end