1 require 'druby'
2
3 obj = DRuby::Client.new('localhost', '9000')
4
5 N = 10000
6 start_time = Time.now
7 (1..N).each do |i|
8 obj.foo(i)
9 end
10 end_time = Time.now
11
12
13 total_time = end_time - start_time
14 puts "Total time: #{total_time}"
15 puts "Messages per second: #{N/total_time}"
16
17 puts "You should see the number #{N}:"
18 puts obj.bar()
19
20 puts "You should see the numbers 1, 2, and 3 on separate lines:"
21 obj.each do |i|
22 puts i
23 end
24
25 puts "You should now see a RuntimeError get thrown:"
26 obj.throw_exception()