Class: Benchmark::IPS::Job::StreamReport

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

Instance Method Summary collapse

Constructor Details

#initialize(stream = $stdout) ⇒ StreamReport

Returns a new instance of StreamReport.



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

def initialize(stream = $stdout)
  @last_item = nil
  @out = stream
end

Instance Method Details

#add_report(item, caller) ⇒ Object



34
35
36
37
# File 'lib/benchmark/ips/job/stream_report.rb', line 34

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


39
40
41
42
43
# File 'lib/benchmark/ips/job/stream_report.rb', line 39

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

#start_runningObject



15
16
17
# File 'lib/benchmark/ips/job/stream_report.rb', line 15

def start_running
  @out.puts "Calculating -------------------------------------"
end

#start_warmingObject



10
11
12
13
# File 'lib/benchmark/ips/job/stream_report.rb', line 10

def start_warming
  @out.puts RUBY_DESCRIPTION
  @out.puts "Warming up --------------------------------------"
end

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



19
20
21
# File 'lib/benchmark/ips/job/stream_report.rb', line 19

def warming(label, _warmup)
  @out.print rjust(label)
end

#warmup_stats(_warmup_time_us, timing) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/benchmark/ips/job/stream_report.rb', line 23

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