Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
pankaj
2014-10-08 14:39:25 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b847eaef8aa2e50cfeda434a87bee48abef9c511
b847eaef
1 parent
3fc72ed2
reduce logging
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
apps/foo/src/main/java/org/onlab/onos/foo/NettyLoggingHandler.java
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
apps/foo/src/main/java/org/onlab/onos/foo/NettyLoggingHandler.java
View file @
b847eae
...
...
@@ -14,6 +14,6 @@ public class NettyLoggingHandler implements MessageHandler {
@Override
public
void
handle
(
Message
message
)
{
log
.
info
(
"Received message. Payload has {} bytes"
,
message
.
payload
().
length
);
//
log.info("Received message. Payload has {} bytes", message.payload().length);
}
}
...
...
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
View file @
b847eae
...
...
@@ -10,11 +10,16 @@ import org.onlab.metrics.MetricsManager;
import
org.onlab.netty.Endpoint
;
import
org.onlab.netty.NettyMessagingService
;
import
org.onlab.netty.Response
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.codahale.metrics.Timer
;
// FIXME: Should be move out to test or app
public
final
class
SimpleNettyClient
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
SimpleNettyClient
.
class
);
private
SimpleNettyClient
()
{
}
...
...
@@ -40,6 +45,7 @@ public final class SimpleNettyClient {
metrics
.
activate
();
MetricsFeature
feature
=
new
MetricsFeature
(
"latency"
);
MetricsComponent
component
=
metrics
.
registerComponent
(
"NettyMessaging"
);
log
.
info
(
"warmup...."
);
for
(
int
i
=
0
;
i
<
warmup
;
i
++)
{
messaging
.
sendAsync
(
new
Endpoint
(
host
,
port
),
"simple"
,
"Hello World"
.
getBytes
());
...
...
@@ -48,6 +54,7 @@ public final class SimpleNettyClient {
"Hello World"
.
getBytes
());
}
log
.
info
(
"measuring async sender"
);
Timer
sendAsyncTimer
=
metrics
.
createTimer
(
component
,
feature
,
"AsyncSender"
);
for
(
int
i
=
0
;
i
<
iterations
;
i
++)
{
...
...
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
View file @
b847eae
...
...
@@ -28,7 +28,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
@Argument
(
index
=
2
,
name
=
"messageCount"
,
description
=
"Message count"
,
required
=
false
,
multiValued
=
false
)
String
messageCount
=
"
50
00000"
;
String
messageCount
=
"
1
00000"
;
@Override
protected
void
execute
()
{
...
...
utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
View file @
b847eae
...
...
@@ -11,6 +11,7 @@ import org.apache.felix.scr.annotations.Deactivate;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.codahale.metrics.ConsoleReporter
;
import
com.codahale.metrics.Counter
;
import
com.codahale.metrics.Gauge
;
import
com.codahale.metrics.Histogram
;
...
...
@@ -18,7 +19,6 @@ import com.codahale.metrics.Meter;
import
com.codahale.metrics.Metric
;
import
com.codahale.metrics.MetricFilter
;
import
com.codahale.metrics.MetricRegistry
;
import
com.codahale.metrics.Slf4jReporter
;
import
com.codahale.metrics.Timer
;
/**
...
...
@@ -70,16 +70,20 @@ public final class MetricsManager implements MetricsService {
/**
* Default Reporter for this metrics manager.
*/
private
final
Slf4jReporter
reporter
;
//private final Slf4jReporter reporter;
private
final
ConsoleReporter
reporter
;
public
MetricsManager
()
{
this
.
metricsRegistry
=
new
MetricRegistry
();
this
.
reporter
=
Slf4jReporter
.
forRegistry
(
this
.
metricsRegistry
)
.
outputTo
(
log
)
// this.reporter = Slf4jReporter.forRegistry(this.metricsRegistry)
// .outputTo(log)
// .convertRatesTo(TimeUnit.SECONDS)
// .convertDurationsTo(TimeUnit.NANOSECONDS)
// .build();
this
.
reporter
=
ConsoleReporter
.
forRegistry
(
this
.
metricsRegistry
)
.
convertRatesTo
(
TimeUnit
.
SECONDS
)
.
convertDurationsTo
(
TimeUnit
.
NANOSECONDS
)
.
build
();
reporter
.
start
(
1
,
TimeUnit
.
MINUTES
);
}
@Activate
...
...
Please
register
or
login
to post a comment