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-07 18:26:07 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
13373b5264b2beaab1a9ed3eb61a104380465091
13373b52
1 parent
33faeaf6
Use arguments to simple client
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
17 deletions
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClient.java
View file @
13373b5
...
...
@@ -30,6 +30,10 @@ public final class SimpleNettyClient {
System
.
exit
(
0
);
}
public
static
void
startStandalone
(
String
...
args
)
throws
Exception
{
String
host
=
args
.
length
>
0
?
args
[
0
]
:
"localhost"
;
int
port
=
args
.
length
>
1
?
Integer
.
parseInt
(
args
[
1
])
:
8081
;
int
warmup
=
args
.
length
>
2
?
Integer
.
parseInt
(
args
[
2
])
:
1000
;
int
iterations
=
args
.
length
>
3
?
Integer
.
parseInt
(
args
[
3
])
:
50
*
100000
;
NettyMessagingService
messaging
=
new
TestNettyMessagingService
(
9081
);
MetricsManager
metrics
=
new
MetricsManager
();
messaging
.
activate
();
...
...
@@ -37,28 +41,26 @@ public final class SimpleNettyClient {
MetricsFeature
feature
=
new
MetricsFeature
(
"latency"
);
MetricsComponent
component
=
metrics
.
registerComponent
(
"NettyMessaging"
);
final
int
warmup
=
10000
;
for
(
int
i
=
0
;
i
<
warmup
;
i
++)
{
messaging
.
sendAsync
(
new
Endpoint
(
"localhost"
,
8081
),
"simple"
,
"Hello World"
.
getBytes
());
messaging
.
sendAsync
(
new
Endpoint
(
host
,
port
),
"simple"
,
"Hello World"
.
getBytes
());
Response
response
=
messaging
.
sendAndReceive
(
new
Endpoint
(
"localhost"
,
8081
),
"echo"
,
.
sendAndReceive
(
new
Endpoint
(
host
,
port
),
"echo"
,
"Hello World"
.
getBytes
());
}
Timer
sendAsyncTimer
=
metrics
.
createTimer
(
component
,
feature
,
"AsyncSender"
);
Timer
sendAndReceiveTimer
=
metrics
.
createTimer
(
component
,
feature
,
"SendAndReceive"
);
final
int
iterations
=
10000000
;
for
(
int
i
=
0
;
i
<
iterations
;
i
++)
{
Timer
.
Context
context
=
sendAsyncTimer
.
time
();
messaging
.
sendAsync
(
new
Endpoint
(
"localhost"
,
8081
),
"simple"
,
"Hello World"
.
getBytes
());
messaging
.
sendAsync
(
new
Endpoint
(
host
,
port
),
"simple"
,
"Hello World"
.
getBytes
());
context
.
stop
();
}
for
(
int
i
=
0
;
i
<
iterations
;
i
++)
{
Timer
.
Context
context
=
sendAndReceiveTimer
.
time
();
Response
response
=
messaging
.
sendAndReceive
(
new
Endpoint
(
"localhost"
,
8081
),
"echo"
,
.
sendAndReceive
(
new
Endpoint
(
host
,
port
),
"echo"
,
"Hello World"
.
getBytes
());
// System.out.println("Got back:" + new String(response.get(2, TimeUnit.SECONDS)));
context
.
stop
();
...
...
apps/foo/src/main/java/org/onlab/onos/foo/SimpleNettyClientCommand.java
View file @
13373b5
...
...
@@ -18,26 +18,22 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
required
=
false
,
multiValued
=
false
)
String
serverIp
=
"127.0.0.1"
;
@Argument
(
index
=
1
,
name
=
"workers"
,
description
=
"IO workers
"
,
@Argument
(
index
=
3
,
name
=
"port"
,
description
=
"Port
"
,
required
=
false
,
multiValued
=
false
)
String
workers
=
"6
"
;
String
port
=
"8081
"
;
@Argument
(
index
=
2
,
name
=
"messageCount"
,
description
=
"Message count"
,
required
=
false
,
multiValued
=
false
)
String
messageCount
=
"1000000"
;
@Argument
(
index
=
3
,
name
=
"messageLength"
,
description
=
"Message length (bytes)"
,
@Argument
(
index
=
1
,
name
=
"warmupCount"
,
description
=
"Warm-up count"
,
required
=
false
,
multiValued
=
false
)
String
messageLength
=
"128
"
;
String
warmup
=
"10000
"
;
@Argument
(
index
=
4
,
name
=
"timeoutSecs"
,
description
=
"Test timeout (seconds)
"
,
@Argument
(
index
=
2
,
name
=
"messageCount"
,
description
=
"Message count
"
,
required
=
false
,
multiValued
=
false
)
String
timeoutSecs
=
"6
0"
;
String
messageCount
=
"10000
0"
;
@Override
protected
void
execute
()
{
try
{
startStandalone
(
new
String
[]{
serverIp
,
workers
,
messageCount
,
messageLength
,
timeoutSecs
});
startStandalone
(
new
String
[]{
serverIp
,
port
,
warmup
,
messageCount
});
}
catch
(
Exception
e
)
{
error
(
"Unable to start client %s"
,
e
);
}
...
...
Please
register
or
login
to post a comment