Class: Benchmark::IPS::Job::StdoutReport

Inherits:
Object
  • Object
show all
Defined in:
lib/benchmark/ips/job/stdout_report.rb

Instance Method Summary collapse

Constructor Details

#initializeStdoutReport

Returns a new instance of StdoutReport.


5
6
7
# File 'lib/benchmark/ips/job/stdout_report.rb', line 5

def initialize
  @last_item = nil
end

Instance Method Details

#add_report(item, caller) ⇒ Object


32
33
34
35
# File 'lib/benchmark/ips/job/stdout_report.rb', line 32

def add_report(item, caller)
  $stdout.puts " #{item.body}"
  @last_item = item
end

37
38
39
40
41
# File 'lib/benchmark/ips/job/stdout_report.rb', line 37

def footer
  return unless @last_item
  footer = @last_item.stats.footer
  $stdout.puts footer.rjust(40) if footer
end

#start_runningObject


13
14
15
# File 'lib/benchmark/ips/job/stdout_report.rb', line 13

def start_running
  $stdout.puts "Calculating -------------------------------------"
end

#start_warmingObject


9
10
11
# File 'lib/benchmark/ips/job/stdout_report.rb', line 9

def start_warming
  $stdout.puts "Warming up --------------------------------------"
end

#warming(label, _warmup) ⇒ Object Also known as: running


17
18
19
# File 'lib/benchmark/ips/job/stdout_report.rb', line 17

def warming(label, _warmup)
  $stdout.print rjust(label)
end

#warmup_stats(_warmup_time_us, timing) ⇒ Object


21
22
23
24
25
26
27
28
# File 'lib/benchmark/ips/job/stdout_report.rb', line 21

def warmup_stats(_warmup_time_us, timing)
  case format
  when :human
    $stdout.printf "%s i/100ms\n", Helpers.scale(timing)
  else
    $stdout.printf "%10d i/100ms\n", timing
  end
end