Class: Tribe::Benchmark::Throughput::MyData
- Inherits:
-
Object
- Object
- Tribe::Benchmark::Throughput::MyData
- Defined in:
- lib/tribe/benchmark/throughput.rb
Instance Method Summary collapse
- #increment ⇒ Object
-
#initialize(name) ⇒ MyData
constructor
A new instance of MyData.
Constructor Details
#initialize(name) ⇒ MyData
Returns a new instance of MyData.
35 36 37 38 39 |
# File 'lib/tribe/benchmark/throughput.rb', line 35 def initialize(name) @name = name @counter = 0 @start_time = Time.now end |
Instance Method Details
#increment ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/tribe/benchmark/throughput.rb', line 41 def increment @counter += 1 if @counter >= MAX_INCR $lock.synchronize do $finished += 1 if $finished == COUNTERS puts "\nFinished! Rate=#{(COUNTERS * MAX_INCR).to_f / (Time.now.utc - $start_time).to_f } msgs/sec\n" end end return false end return true end |