Class: Tracee::Benchmark
- Inherits:
-
Object
- Object
- Tracee::Benchmark
- Defined in:
- lib/tracee/benchmarkable.rb
Instance Attribute Summary collapse
-
#last_pass ⇒ Object
readonly
Returns the value of attribute last_pass.
-
#tick_number ⇒ Object
readonly
Returns the value of attribute tick_number.
-
#ticks_diffs ⇒ Object
readonly
Returns the value of attribute ticks_diffs.
Instance Method Summary collapse
- #add_time(amount) ⇒ Object
- #first! ⇒ Object
-
#initialize ⇒ Benchmark
constructor
A new instance of Benchmark.
- #last_pass! ⇒ Object
- #next ⇒ Object
- #tick_diff ⇒ Object
Constructor Details
#initialize ⇒ Benchmark
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_pass ⇒ Object (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_number ⇒ Object (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_diffs ⇒ Object (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 |
#next ⇒ Object
112 113 114 |
# File 'lib/tracee/benchmarkable.rb', line 112 def next @tick_number += 1 end |
#tick_diff ⇒ Object
120 121 122 |
# File 'lib/tracee/benchmarkable.rb', line 120 def tick_diff @ticks_diffs[@tick_number] end |