# HG changeset patch # User kazz # Date 1328610890 -32400 # Node ID 0c2ad7c70f4e5dd867a78cc9d0e6028ff9f91ac9 # Parent 27a64e771c4c7e35accc0a1e81d0093b7154092f change ring calculate time unit, milli to nano diff -r 27a64e771c4c -r 0c2ad7c70f4e src/alice/test/topology/ring/CheckMyName.java --- a/src/alice/test/topology/ring/CheckMyName.java Sun Feb 05 18:24:39 2012 +0900 +++ b/src/alice/test/topology/ring/CheckMyName.java Tue Feb 07 19:34:50 2012 +0900 @@ -1,7 +1,5 @@ package alice.test.topology.ring; -import java.util.Date; - import org.apache.log4j.Logger; import alice.codesegment.CodeSegment; @@ -23,7 +21,7 @@ logger.debug(host); if (host.equals("node0")) { ods.put("local", "counter", 0); - FirstRingMessagePassing cs1 = new FirstRingMessagePassing(new Date(), conf.count); + FirstRingMessagePassing cs1 = new FirstRingMessagePassing(System.nanoTime(), conf.count); cs1.counter.setKey("local", "counter"); RingFinish cs2 = new RingFinish("manager"); cs2.finish.setKey("local", "finish"); diff -r 27a64e771c4c -r 0c2ad7c70f4e src/alice/test/topology/ring/FirstRingMessagePassing.java --- a/src/alice/test/topology/ring/FirstRingMessagePassing.java Sun Feb 05 18:24:39 2012 +0900 +++ b/src/alice/test/topology/ring/FirstRingMessagePassing.java Tue Feb 07 19:34:50 2012 +0900 @@ -1,7 +1,5 @@ package alice.test.topology.ring; -import java.util.Date; - import org.msgpack.type.ValueFactory; import alice.codesegment.CodeSegment; @@ -11,10 +9,10 @@ public class FirstRingMessagePassing extends CodeSegment { public Receiver counter = ids.create(CommandType.TAKE); - private Date startTime; + private long startTime; private int count; - public FirstRingMessagePassing(Date startTime, int count) { + public FirstRingMessagePassing(long startTime, int count) { this.startTime = startTime; this.count = count; } @@ -26,8 +24,8 @@ ods.put("right", "counter", counter); if (counter >= count) { ods.put("right", "finish", ValueFactory.createNilValue()); - Date endTime = new Date(); - long time = endTime.getTime() - startTime.getTime(); + long endTime = System.nanoTime(); + long time = endTime - startTime; System.out.println(count + ", " + time); return; }