class Tribe::Benchmark::Throughput::MyData

Public Class Methods

new(name) click to toggle source
# File lib/tribe/benchmark/throughput.rb, line 35
def initialize(name)
  @name = name
  @counter = 0
  @start_time = Time.now
end

Public Instance Methods

increment() click to toggle source
# 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