Module: Tribe::Benchmark::Throughput

Defined in:
lib/tribe/benchmark/throughput.rb

Defined Under Namespace

Classes: MyActor, MyData

Constant Summary collapse

MAX_INCR =
100000
ACTOR_COUNT =
100000
COUNTERS =
20

Class Method Summary collapse

Class Method Details

.runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tribe/benchmark/throughput.rb', line 8

def self.run
  ACTOR_COUNT.times do |i|
    actor = Tribe.registry["actor_#{i}"]
    actor.shutdown! if actor
  end

  $start_time = Time.now.utc
  $finished = 0
  $lock = Mutex.new

  ACTOR_COUNT.times do |i|
    MyActor.new(:name => "actor_#{i}")
  end

  COUNTERS.times do |i|
    Tribe.registry["actor_#{rand(ACTOR_COUNT)}"].direct_message!(:do_stuff, MyData.new("data_#{i}"))
  end

  $lock.synchronize do
    puts 'Please wait...'
  end
end

.stopObject



31
32
# File 'lib/tribe/benchmark/throughput.rb', line 31

def self.stop
end