Mercurial > hg > Members > tatsuki > Alice
view src/alice/test/topology/ring/FirstRingMessagePassing.java @ 46:1a498f436332
bug fix for time calculate
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 04 Feb 2012 16:03:05 +0900 |
parents | ae24d5d40c10 |
children | 5b6624b2f055 |
line wrap: on
line source
package alice.test.topology.ring; import java.util.Date; import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class FirstRingMessagePassing extends CodeSegment { public Receiver counter = ids.create(CommandType.TAKE); private Date startTime; private int count; public FirstRingMessagePassing(Date startTime, int count) { this.startTime = startTime; this.count = count; } @Override public void run() { int counter = this.counter.asInteger(); ++counter; ods.put("right", "counter", counter); System.out.println(count); if (counter >= count) { ods.put("right", "finish", ValueFactory.createNilValue()); Date endTime = new Date(); long time = endTime.getTime() - startTime.getTime(); System.out.println(time); return; } FirstRingMessagePassing cs = new FirstRingMessagePassing(startTime, count); cs.counter.setKey("local", "counter"); } }