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
tom
2014-09-26 12:19:51 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5f4df2d5ebc59d9e941c6e3b5d60fefae65d644a
5f4df2d5
1 parent
9251d194
Working on IO loop tests commands.
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
16 deletions
apps/foo/src/main/java/org/onlab/onos/foo/IOLoopTestClient.java
apps/foo/src/main/java/org/onlab/onos/foo/IOLoopTestServer.java
utils/nio/src/test/java/org/onlab/nio/IOLoopTestClient.java
utils/nio/src/test/java/org/onlab/nio/IOLoopTestServer.java
apps/foo/src/main/java/org/onlab/onos/foo/IOLoopTestClient.java
View file @
5f4df2d
...
...
@@ -27,6 +27,7 @@ import java.util.concurrent.TimeoutException;
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
.
onos
.
foo
.
IOLoopTestServer
.
PORT
;
import
static
org
.
onlab
.
util
.
Tools
.
delay
;
...
...
@@ -185,7 +186,7 @@ public class IOLoopTestClient {
*/
public
void
report
()
{
DecimalFormat
f
=
new
DecimalFormat
(
"#,##0"
);
out
.
println
(
format
(
"Client: %s messages; %s bytes; %s mps; %s Mbs; %s
m
s latency"
,
out
.
println
(
format
(
"Client: %s messages; %s bytes; %s mps; %s Mbs; %s
n
s latency"
,
f
.
format
(
messages
.
total
()),
f
.
format
(
bytes
.
total
()),
f
.
format
(
messages
.
throughput
()),
f
.
format
(
bytes
.
throughput
()
/
(
1024
*
msgLength
)),
...
...
@@ -233,7 +234,7 @@ public class IOLoopTestClient {
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
());
...
...
@@ -254,7 +255,7 @@ public class IOLoopTestClient {
*/
private
class
Worker
implements
Runnable
{
private
static
final
int
BATCH_SIZE
=
10
00
;
private
static
final
int
BATCH_SIZE
=
10
;
private
static
final
int
PERMITS
=
2
*
BATCH_SIZE
;
private
TestMessageStream
stream
;
...
...
@@ -297,7 +298,7 @@ public class IOLoopTestClient {
// 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
,
batch
.
add
(
new
TestMessage
(
msgLength
,
nanoTime
(),
0
,
stream
.
padding
()));
}
acquire
(
size
);
...
...
apps/foo/src/main/java/org/onlab/onos/foo/IOLoopTestServer.java
View file @
5f4df2d
...
...
@@ -24,6 +24,7 @@ import java.util.concurrent.Executors;
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
.
util
.
Tools
.
delay
;
import
static
org
.
onlab
.
util
.
Tools
.
namedThreads
;
...
...
@@ -92,6 +93,7 @@ public class IOLoopTestServer {
int
r
=
server
.
prune
();
remaining
=
remaining
==
-
1
&&
r
==
0
?
remaining
:
r
;
}
server
.
stop
();
}
/**
...
...
@@ -220,7 +222,7 @@ public class IOLoopTestServer {
List
<
TestMessage
>
responses
=
Lists
.
newArrayListWithCapacity
(
messages
.
size
());
for
(
TestMessage
message
:
messages
)
{
responses
.
add
(
new
TestMessage
(
message
.
length
(),
message
.
requestorTime
(),
currentTimeMillis
(),
message
.
padding
()));
nanoTime
(),
message
.
padding
()));
}
return
responses
;
}
...
...
utils/nio/src/test/java/org/onlab/nio/IOLoopTestClient.java
View file @
5f4df2d
...
...
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeoutException;
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 class IOLoopTestClient {
*/
public
void
report
()
{
DecimalFormat
f
=
new
DecimalFormat
(
"#,##0"
);
out
.
println
(
format
(
"Client: %s messages; %s bytes; %s mps; %s Mbs; %s
m
s latency"
,
out
.
println
(
format
(
"Client: %s messages; %s bytes; %s mps; %s Mbs; %s
n
s latency"
,
f
.
format
(
messages
.
total
()),
f
.
format
(
bytes
.
total
()),
f
.
format
(
messages
.
throughput
()),
f
.
format
(
bytes
.
throughput
()
/
(
1024
*
msgLength
)),
...
...
@@ -231,7 +232,7 @@ public class IOLoopTestClient {
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 @@ public class IOLoopTestClient {
*/
private
class
Worker
implements
Runnable
{
private
static
final
int
BATCH_SIZE
=
100
0
;
private
static
final
int
BATCH_SIZE
=
5
0
;
private
static
final
int
PERMITS
=
2
*
BATCH_SIZE
;
private
TestMessageStream
stream
;
...
...
@@ -295,8 +296,7 @@ public class IOLoopTestClient {
// 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
);
...
...
utils/nio/src/test/java/org/onlab/nio/IOLoopTestServer.java
View file @
5f4df2d
...
...
@@ -82,11 +82,14 @@ public class IOLoopTestServer {
IOLoopTestServer
server
=
new
IOLoopTestServer
(
ip
,
wc
,
ml
,
PORT
);
server
.
start
();
// Start pruning clients.
while
(
true
)
{
// Start pruning clients and keep going until their number goes to 0.
int
remaining
=
-
1
;
while
(
remaining
==
-
1
||
remaining
>
0
)
{
delay
(
PRUNE_FREQUENCY
);
server
.
prune
();
int
r
=
server
.
prune
();
remaining
=
remaining
==
-
1
&&
r
==
0
?
remaining
:
r
;
}
server
.
stop
();
}
/**
...
...
@@ -158,11 +161,15 @@ public class IOLoopTestServer {
/**
* Prunes the IO loops of stale message buffers.
*
* @return number of remaining IO loops among all workers.
*/
public
void
prune
()
{
public
int
prune
()
{
int
count
=
0
;
for
(
CustomIOLoop
l
:
iloops
)
{
l
.
pruneStaleStreams
();
count
+=
l
.
pruneStaleStreams
();
}
return
count
;
}
// Get the next worker to which a client should be assigned
...
...
@@ -211,7 +218,7 @@ public class IOLoopTestServer {
List
<
TestMessage
>
responses
=
Lists
.
newArrayListWithCapacity
(
messages
.
size
());
for
(
TestMessage
message
:
messages
)
{
responses
.
add
(
new
TestMessage
(
message
.
length
(),
message
.
requestorTime
(),
currentTimeMillis
(),
message
.
padding
()));
System
.
nanoTime
(),
message
.
padding
()));
}
return
responses
;
}
...
...
Please
register
or
login
to post a comment