module Benchmark::IPS
def self.options
:human format narrows precision and scales results for readability
:format => [:human, :raw]
Set options for running the benchmarks.
def self.options @options ||= {:format => :human} end
def ips(time=nil, warmup=nil)
-
(Report)
-
Parameters:
-
warmup
(Integer
) -- Specify how long should Warmup time run in seconds. -
time
(Integer
) -- Specify how long should benchmark your code in seconds.
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