Ayaka Koshibe

Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next

......@@ -41,6 +41,7 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
int iterations = args.length > 3 ? Integer.parseInt(args[3]) : 50 * 100000;
NettyMessagingService messaging = new TestNettyMessagingService(9081);
MetricsManager metrics = new MetricsManager();
Endpoint endpoint = new Endpoint(host, port);
messaging.activate();
metrics.activate();
MetricsFeature feature = new MetricsFeature("latency");
......@@ -48,9 +49,9 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
log.info("warmup....");
for (int i = 0; i < warmup; i++) {
messaging.sendAsync(new Endpoint(host, port), "simple", "Hello World".getBytes());
messaging.sendAsync(endpoint, "simple", "Hello World".getBytes());
Response response = messaging
.sendAndReceive(new Endpoint(host, port), "echo",
.sendAndReceive(endpoint, "echo",
"Hello World".getBytes());
}
......@@ -59,7 +60,7 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
for (int i = 0; i < iterations; i++) {
Timer.Context context = sendAsyncTimer.time();
messaging.sendAsync(new Endpoint(host, port), "simple", "Hello World".getBytes());
messaging.sendAsync(endpoint, "simple", "Hello World".getBytes());
context.stop();
}
......@@ -67,7 +68,7 @@ private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
for (int i = 0; i < iterations; i++) {
Timer.Context context = sendAndReceiveTimer.time();
Response response = messaging
.sendAndReceive(new Endpoint(host, port), "echo",
.sendAndReceive(endpoint, "echo",
"Hello World".getBytes());
// System.out.println("Got back:" + new String(response.get(2, TimeUnit.SECONDS)));
context.stop();
......
......@@ -16,7 +16,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
//FIXME: replace these arguments with proper ones needed for the test.
@Argument(index = 0, name = "hostname", description = "Server Hostname",
required = false, multiValued = false)
String host = "localhost";
String hostname = "localhost";
@Argument(index = 3, name = "port", description = "Port",
required = false, multiValued = false)
......@@ -24,7 +24,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
@Argument(index = 1, name = "warmupCount", description = "Warm-up count",
required = false, multiValued = false)
String warmup = "1000";
String warmupCount = "1000";
@Argument(index = 2, name = "messageCount", description = "Message count",
required = false, multiValued = false)
......@@ -33,10 +33,9 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
@Override
protected void execute() {
try {
startStandalone(new String[]{host, port, warmup, messageCount});
startStandalone(new String[]{hostname, port, warmupCount, messageCount});
} catch (Exception e) {
error("Unable to start client %s", e);
}
}
}
......
......@@ -78,11 +78,11 @@ public final class MetricsManager implements MetricsService {
// this.reporter = Slf4jReporter.forRegistry(this.metricsRegistry)
// .outputTo(log)
// .convertRatesTo(TimeUnit.SECONDS)
// .convertDurationsTo(TimeUnit.NANOSECONDS)
// .convertDurationsTo(TimeUnit.MICROSECONDS)
// .build();
this.reporter = ConsoleReporter.forRegistry(this.metricsRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.NANOSECONDS)
.convertDurationsTo(TimeUnit.MICROSECONDS)
.build();
}
......