Mercurial > hg > Database > Alice
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 |
rev | line source |
---|---|
30 | 1 package alice.test.topology.ring; |
2 | |
3 import org.msgpack.type.ValueFactory; | |
4 | |
5 import alice.codesegment.CodeSegment; | |
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 | 8 |
9 public class FirstRingMessagePassing extends CodeSegment { | |
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 | 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 | 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 | 28 @Override |
29 public void run() { | |
214 | 30 ods.put("right", "c", ds1.getVal()); // copy whole DataSegment to the right |
31 if (ds1.index > count) { // after count time update of ds1 | |
30 | 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 | 36 return; |
30 | 37 } |
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 | 41 } |
42 | |
43 } |