Working on IO loop tests commands.
diff --git a/utils/nio/src/test/java/org/onlab/nio/IOLoopTestClient.java b/utils/nio/src/test/java/org/onlab/nio/IOLoopTestClient.java
index 6f6bd6d..dba0b18 100644
--- a/utils/nio/src/test/java/org/onlab/nio/IOLoopTestClient.java
+++ b/utils/nio/src/test/java/org/onlab/nio/IOLoopTestClient.java
@@ -25,6 +25,7 @@
import static java.lang.String.format;
import static java.lang.System.currentTimeMillis;
+import static java.lang.System.nanoTime;
import static java.lang.System.out;
import static org.onlab.nio.IOLoopTestServer.PORT;
import static org.onlab.util.Tools.delay;
@@ -183,7 +184,7 @@
*/
public void report() {
DecimalFormat f = new DecimalFormat("#,##0");
- out.println(format("Client: %s messages; %s bytes; %s mps; %s Mbs; %s ms latency",
+ out.println(format("Client: %s messages; %s bytes; %s mps; %s Mbs; %s ns latency",
f.format(messages.total()), f.format(bytes.total()),
f.format(messages.throughput()),
f.format(bytes.throughput() / (1024 * msgLength)),
@@ -231,7 +232,7 @@
MessageStream<TestMessage> stream) {
for (TestMessage message : messages) {
// TODO: summarize latency data better
- latencyTotal += currentTimeMillis() - message.requestorTime();
+ latencyTotal += nanoTime() - message.requestorTime();
latencyCount++;
}
worker.release(messages.size());
@@ -252,7 +253,7 @@
*/
private class Worker implements Runnable {
- private static final int BATCH_SIZE = 1000;
+ private static final int BATCH_SIZE = 50;
private static final int PERMITS = 2 * BATCH_SIZE;
private TestMessageStream stream;
@@ -295,8 +296,7 @@
// Build a batch of messages
List<TestMessage> batch = Lists.newArrayListWithCapacity(size);
for (int i = 0; i < size; i++) {
- batch.add(new TestMessage(msgLength, currentTimeMillis(), 0,
- stream.padding()));
+ batch.add(new TestMessage(msgLength, nanoTime(), 0, stream.padding()));
}
acquire(size);
stream.write(batch);