Mercurial > hg > Database > Alice
view src/alice/test/topology/ring/FirstRingMessagePassing.java @ 70:f2d4a4686036
delete CodeSegment receive thread
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Feb 2012 20:09:18 +0900 (2012-02-21) |
parents | ca42a2c8ac22 |
children | 728c254347a6 |
line wrap: on
line source
package alice.test.topology.ring; 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 long startTime; private int count; private int nodeNum; public FirstRingMessagePassing(long startTime, int count, int nodeNum) { this.startTime = startTime; this.count = count; this.nodeNum = nodeNum; } @Override public void run() { ods.put("right", "c", counter.val); if (counter.index > count) { ods.put("right", "finish", ValueFactory.createNilValue()); long endTime = System.nanoTime(); long time = endTime - startTime; System.out.println(nodeNum + ", " + time / (count * 1000000.0f)); return; } FirstRingMessagePassing cs = new FirstRingMessagePassing(startTime, count, nodeNum); cs.counter.setKey("c"); } }