pankaj

reduce logging

...@@ -14,6 +14,6 @@ public class NettyLoggingHandler implements MessageHandler { ...@@ -14,6 +14,6 @@ public class NettyLoggingHandler implements MessageHandler {
14 14
15 @Override 15 @Override
16 public void handle(Message message) { 16 public void handle(Message message) {
17 - log.info("Received message. Payload has {} bytes", message.payload().length); 17 + //log.info("Received message. Payload has {} bytes", message.payload().length);
18 } 18 }
19 } 19 }
......
...@@ -10,12 +10,17 @@ import org.onlab.metrics.MetricsManager; ...@@ -10,12 +10,17 @@ import org.onlab.metrics.MetricsManager;
10 import org.onlab.netty.Endpoint; 10 import org.onlab.netty.Endpoint;
11 import org.onlab.netty.NettyMessagingService; 11 import org.onlab.netty.NettyMessagingService;
12 import org.onlab.netty.Response; 12 import org.onlab.netty.Response;
13 +import org.slf4j.Logger;
14 +import org.slf4j.LoggerFactory;
13 15
14 import com.codahale.metrics.Timer; 16 import com.codahale.metrics.Timer;
15 17
16 // FIXME: Should be move out to test or app 18 // FIXME: Should be move out to test or app
17 public final class SimpleNettyClient { 19 public final class SimpleNettyClient {
18 - private SimpleNettyClient() { 20 +
21 +private static Logger log = LoggerFactory.getLogger(SimpleNettyClient.class);
22 +
23 + private SimpleNettyClient() {
19 } 24 }
20 25
21 public static void main(String[] args) 26 public static void main(String[] args)
...@@ -40,6 +45,7 @@ public final class SimpleNettyClient { ...@@ -40,6 +45,7 @@ public final class SimpleNettyClient {
40 metrics.activate(); 45 metrics.activate();
41 MetricsFeature feature = new MetricsFeature("latency"); 46 MetricsFeature feature = new MetricsFeature("latency");
42 MetricsComponent component = metrics.registerComponent("NettyMessaging"); 47 MetricsComponent component = metrics.registerComponent("NettyMessaging");
48 + log.info("warmup....");
43 49
44 for (int i = 0; i < warmup; i++) { 50 for (int i = 0; i < warmup; i++) {
45 messaging.sendAsync(new Endpoint(host, port), "simple", "Hello World".getBytes()); 51 messaging.sendAsync(new Endpoint(host, port), "simple", "Hello World".getBytes());
...@@ -48,6 +54,7 @@ public final class SimpleNettyClient { ...@@ -48,6 +54,7 @@ public final class SimpleNettyClient {
48 "Hello World".getBytes()); 54 "Hello World".getBytes());
49 } 55 }
50 56
57 + log.info("measuring async sender");
51 Timer sendAsyncTimer = metrics.createTimer(component, feature, "AsyncSender"); 58 Timer sendAsyncTimer = metrics.createTimer(component, feature, "AsyncSender");
52 59
53 for (int i = 0; i < iterations; i++) { 60 for (int i = 0; i < iterations; i++) {
......
...@@ -28,7 +28,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand { ...@@ -28,7 +28,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
28 28
29 @Argument(index = 2, name = "messageCount", description = "Message count", 29 @Argument(index = 2, name = "messageCount", description = "Message count",
30 required = false, multiValued = false) 30 required = false, multiValued = false)
31 - String messageCount = "5000000"; 31 + String messageCount = "100000";
32 32
33 @Override 33 @Override
34 protected void execute() { 34 protected void execute() {
......
...@@ -11,6 +11,7 @@ import org.apache.felix.scr.annotations.Deactivate; ...@@ -11,6 +11,7 @@ import org.apache.felix.scr.annotations.Deactivate;
11 import org.slf4j.Logger; 11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 12 import org.slf4j.LoggerFactory;
13 13
14 +import com.codahale.metrics.ConsoleReporter;
14 import com.codahale.metrics.Counter; 15 import com.codahale.metrics.Counter;
15 import com.codahale.metrics.Gauge; 16 import com.codahale.metrics.Gauge;
16 import com.codahale.metrics.Histogram; 17 import com.codahale.metrics.Histogram;
...@@ -18,7 +19,6 @@ import com.codahale.metrics.Meter; ...@@ -18,7 +19,6 @@ import com.codahale.metrics.Meter;
18 import com.codahale.metrics.Metric; 19 import com.codahale.metrics.Metric;
19 import com.codahale.metrics.MetricFilter; 20 import com.codahale.metrics.MetricFilter;
20 import com.codahale.metrics.MetricRegistry; 21 import com.codahale.metrics.MetricRegistry;
21 -import com.codahale.metrics.Slf4jReporter;
22 import com.codahale.metrics.Timer; 22 import com.codahale.metrics.Timer;
23 23
24 /** 24 /**
...@@ -70,16 +70,20 @@ public final class MetricsManager implements MetricsService { ...@@ -70,16 +70,20 @@ public final class MetricsManager implements MetricsService {
70 /** 70 /**
71 * Default Reporter for this metrics manager. 71 * Default Reporter for this metrics manager.
72 */ 72 */
73 - private final Slf4jReporter reporter; 73 + //private final Slf4jReporter reporter;
74 + private final ConsoleReporter reporter;
74 75
75 public MetricsManager() { 76 public MetricsManager() {
76 this.metricsRegistry = new MetricRegistry(); 77 this.metricsRegistry = new MetricRegistry();
77 - this.reporter = Slf4jReporter.forRegistry(this.metricsRegistry) 78 +// this.reporter = Slf4jReporter.forRegistry(this.metricsRegistry)
78 - .outputTo(log) 79 +// .outputTo(log)
80 +// .convertRatesTo(TimeUnit.SECONDS)
81 +// .convertDurationsTo(TimeUnit.NANOSECONDS)
82 +// .build();
83 + this.reporter = ConsoleReporter.forRegistry(this.metricsRegistry)
79 .convertRatesTo(TimeUnit.SECONDS) 84 .convertRatesTo(TimeUnit.SECONDS)
80 .convertDurationsTo(TimeUnit.NANOSECONDS) 85 .convertDurationsTo(TimeUnit.NANOSECONDS)
81 .build(); 86 .build();
82 - reporter.start(1, TimeUnit.MINUTES);
83 } 87 }
84 88
85 @Activate 89 @Activate
......