9 class PingPongTask < MSG::Task
11 # The initialize method has no effect
26 class Sender < MSG::Process
29 MSG::info("Hello from Sender")
31 MSG::info("Host count :" + hostCount.to_s)
34 for i in 0..hostCount-1
35 mailboxes<< MSG::Host.getByName(args[i]).name
38 for i in 0..hostCount-1
40 MSG::info("sender time :"+time.to_s)
41 task = PingPongTask.new("PingTask",10000,2000)
42 MSG::info("task created :" + task.name);
43 #task.join(time) -- MSG::task.join(data) is a Native method you can use to attach any data you want to the task
45 task.send(mailboxes[i])
55 class Receiver < MSG::Process
58 MSG::info("Hello from Receiver")
60 host = MSG::Host.getHostProcess(self)
61 task = PingPongTask.receive(host.name)
62 timeGot = MSG.getClock
63 MSG::info("Got at time: "+timeGot.to_s)
64 #timeSent = task.data --
65 timeSent = task.getTime
66 MSG::info("Was sent at time "+timeSent.to_s)
67 communicationTime = timeGot - time
68 MSG::info("Communication Time: "+communicationTime.to_s)
69 MSG::info("--- bw "+(100000000/communicationTime).to_s+" ----")
75 #################################################
77 #################################################
80 MSG.createEnvironment(ARGV[0])
81 MSG.deployApplication(ARGV[1])
83 MSG.createEnvironment("ping_pong_platform.xml")
84 MSG.deployApplication("ping_pong_deployment.xml")