X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7bcd4cc9d936caa1d23579f7aca67e68fade2a36..de7d161240f434a809ae7739fbb15a1db6ab86f2:/src/bindings/ruby/PingPong.rb diff --git a/src/bindings/ruby/PingPong.rb b/src/bindings/ruby/PingPong.rb index 2281b1d4e3..57adbc42f3 100644 --- a/src/bindings/ruby/PingPong.rb +++ b/src/bindings/ruby/PingPong.rb @@ -8,14 +8,12 @@ include MSG class PingPongTask < MSG::Task - def initialize(*args) + puts "Here is the ping pong initializer" #Has No Role, Since Its The Task Class ( Created from C ) tht will be called , # and any instruction here will be ignored end - - end #################### @@ -38,16 +36,17 @@ class Sender < MSG::Process end for i in 0..hostCount-1 - time = MSG.getClock.to_s # to send as a data >> must be a string + time = MSG.getClock MSG::info("sender time :"+time.to_s) task = PingPongTask.new("PingTask",10000,2000) + MSG::info("task created :" + task.name); task.setData(time) p "mailboxe >>> "+ mailboxes[i] task.send(mailboxes[i]) end - MSG::info("GoodBye !!!") - + MSG::info("GoodBye !!!") + end end @@ -59,17 +58,15 @@ class Sender < MSG::Process class Receiver < MSG::Process def main(args) - MSG::info("Hello from Receiver") time = MSG.getClock MSG::info("Try to get a task") host = MSG::Host.getHostProcess(self) task = PingPongTask.receive(host.name) p "task name recevied : "+ task.name - p "data in the task :" + task.data timeGot = MSG.getClock - timeSent= task.data MSG::info("Got at time: "+timeGot.to_s) + timeSent = task.data MSG::info("Was sent at time "+timeSent.to_s) communicationTime = timeGot - time MSG::info("Communication Time: "+communicationTime.to_s) @@ -77,7 +74,6 @@ class Receiver < MSG::Process MSG::info("GoodBye !!!") end - end ################################################# @@ -90,7 +86,6 @@ if (ARGV.length == 2) else MSG.createEnvironment("ping_pong_platform.xml") MSG.deployApplication("ping_pong_deployment.xml") - end MSG.run