annotate src/alice/test/topology/ring/FirstRingMessagePassing.java @ 214:fec0726bb126 working

remove error
author one
date Wed, 27 Mar 2013 18:16:34 +0900
parents b5daccf36104
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package alice.test.topology.ring;
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 import org.msgpack.type.ValueFactory;
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 import alice.codesegment.CodeSegment;
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 import alice.datasegment.CommandType;
33
20c67f673224 change name of DataSegmentReceiver
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 32
diff changeset
7 import alice.datasegment.Receiver;
30
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 public class FirstRingMessagePassing extends CodeSegment {
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
76
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
11 public Receiver ds1 = ids.create(CommandType.TAKE);
55
0c2ad7c70f4e change ring calculate time unit, milli to nano
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 48
diff changeset
12 private long startTime;
62
ead04b496305 change print relay count to node num on ring
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
13 private int count;
76
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
14 private int nodeNum;
45
ae24d5d40c10 add to calculate the time of RingTopology required
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
15
62
ead04b496305 change print relay count to node num on ring
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
16 public FirstRingMessagePassing(long startTime, int count, int nodeNum) {
45
ae24d5d40c10 add to calculate the time of RingTopology required
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
17 this.startTime = startTime;
46
1a498f436332 bug fix for time calculate
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
18 this.count = count;
62
ead04b496305 change print relay count to node num on ring
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
19 this.nodeNum = nodeNum;
45
ae24d5d40c10 add to calculate the time of RingTopology required
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
20 }
30
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
76
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
22 public FirstRingMessagePassing(int count, int nodeNum) { // at first
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
23 this.startTime = System.nanoTime();
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
24 this.count = count;
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
25 this.nodeNum = nodeNum;
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
26 }
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
27
30
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 @Override
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 public void run() {
214
fec0726bb126 remove error
one
parents: 212
diff changeset
30 ods.put("right", "c", ds1.getVal()); // copy whole DataSegment to the right
fec0726bb126 remove error
one
parents: 212
diff changeset
31 if (ds1.index > count) { // after count time update of ds1
30
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 ods.put("right", "finish", ValueFactory.createNilValue());
55
0c2ad7c70f4e change ring calculate time unit, milli to nano
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 48
diff changeset
33 long endTime = System.nanoTime();
0c2ad7c70f4e change ring calculate time unit, milli to nano
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 48
diff changeset
34 long time = endTime - startTime;
72
728c254347a6 modify output of ring script
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 70
diff changeset
35 System.out.println(nodeNum + " " + time / count / 1000000.0);
79
6d0086a503d3 fix conf of ring
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 76
diff changeset
36 return;
30
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 }
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
62
ead04b496305 change print relay count to node num on ring
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
39 FirstRingMessagePassing cs = new FirstRingMessagePassing(startTime, count, nodeNum);
76
4a2ecd0a5e8f refactor test code segments
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 72
diff changeset
40 cs.ds1.setKey("c");
30
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 }
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
b5a21baf0b07 implements RingTopology
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 }