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
|