Class: Benchmark::BigO::Job::Entry

Inherits:
IPS::Job::Entry
  • Object
show all
Defined in:
lib/benchmark/bigo/job.rb

Instance Method Summary collapse

Constructor Details

#initialize(label, action, generated, size) ⇒ Entry

Returns a new instance of Entry.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/benchmark/bigo/job.rb', line 8

def initialize label, action, generated, size
  super label, action

  if @as_action
    raise "as_action not supported yet"
  else
    raise ArgumentError if action.arity != 2
    @call_loop = false
  end

  # these objects can be very large, do not want
  # them to be displayed as part of inspect
  define_singleton_method(:generated) { generated }
  define_singleton_method(:size) { size }
end

Instance Method Details

#call_times(times) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/benchmark/bigo/job.rb', line 24

def call_times(times)
  act = @action

  i = 0
  while i < times
    act.call generated, size
    i += 1
  end
end