Class: Tracee::Benchmark

Inherits:
Object show all
Defined in:
lib/tracee/benchmarkable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBenchmark

Returns a new instance of Benchmark.



100
101
102
# File 'lib/tracee/benchmarkable.rb', line 100

def initialize
  @ticks_diffs = Hash.new {|h, k| h[k] = 0}
end

Instance Attribute Details

#last_passObject (readonly)

Returns the value of attribute last_pass.



98
99
100
# File 'lib/tracee/benchmarkable.rb', line 98

def last_pass
  @last_pass
end

#tick_numberObject (readonly)

Returns the value of attribute tick_number.



98
99
100
# File 'lib/tracee/benchmarkable.rb', line 98

def tick_number
  @tick_number
end

#ticks_diffsObject (readonly)

Returns the value of attribute ticks_diffs.



98
99
100
# File 'lib/tracee/benchmarkable.rb', line 98

def ticks_diffs
  @ticks_diffs
end

Instance Method Details

#add_time(amount) ⇒ Object



116
117
118
# File 'lib/tracee/benchmarkable.rb', line 116

def add_time(amount)
  @ticks_diffs[@tick_number] += amount
end

#first!Object



108
109
110
# File 'lib/tracee/benchmarkable.rb', line 108

def first!
  @tick_number = 0
end

#last_pass!Object



104
105
106
# File 'lib/tracee/benchmarkable.rb', line 104

def last_pass!
  @last_pass = true
end

#nextObject



112
113
114
# File 'lib/tracee/benchmarkable.rb', line 112

def next
  @tick_number += 1
end

#tick_diffObject



120
121
122
# File 'lib/tracee/benchmarkable.rb', line 120

def tick_diff
  @ticks_diffs[@tick_number]
end