o Added a bio package for BIO based benchlarks
o Added a BioClientBioServer benchmark
o Added some headers

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/87d54a21
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/87d54a21
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/87d54a21

Branch: refs/heads/trunk
Commit: 87d54a21d29a90db0fa5b4e6a8f8ee9294a1e564
Parents: b39ee91
Author: Emmanuel Lécharny <[email protected]>
Authored: Mon May 27 20:02:41 2013 +0200
Committer: Emmanuel Lécharny <[email protected]>
Committed: Mon May 27 20:02:41 2013 +0200

----------------------------------------------------------------------
 .../apache/mina/core/BenchmarkClientFactory.java   |    2 +-
 .../apache/mina/core/BenchmarkServerFactory.java   |    5 +
 ...3ClientVsMina3ServerUdpBenchmarkBinaryTest.java |    2 +-
 .../mina/core/bio/udp/BioUdpBenchmarkClient.java   |   80 +++++++++++++++
 .../mina/core/nio/udp/BioUdpBenchmarkClient.java   |   80 ---------------
 .../mina/core/nio/udp/Mina3UdpBenchmarkClient.java |    3 +
 .../mina/core/nio/udp/Mina3UdpBenchmarkServer.java |    2 +
 .../core/nio/udp/Netty3UdpBenchmarkClient.java     |    1 +
 .../core/nio/udp/Netty3UdpBenchmarkServer.java     |    2 +
 9 files changed, 95 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java 
b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
index 7af63c5..1bfc492 100755
--- a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkClientFactory.java
@@ -19,9 +19,9 @@
  */
 package org.apache.mina.core;
 
+import org.apache.mina.core.bio.udp.BioUdpBenchmarkClient;
 import org.apache.mina.core.nio.tcp.Mina3TcpBenchmarkClient;
 import org.apache.mina.core.nio.tcp.Netty3TcpBenchmarkClient;
-import org.apache.mina.core.nio.udp.BioUdpBenchmarkClient;
 import org.apache.mina.core.nio.udp.Mina3UdpBenchmarkClient;
 import org.apache.mina.core.nio.udp.Netty3UdpBenchmarkClient;
 

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java 
b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
index e2a7015..21eeb0f 100755
--- a/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
+++ b/benchmarks/src/test/java/org/apache/mina/core/BenchmarkServerFactory.java
@@ -19,6 +19,7 @@
  */
 package org.apache.mina.core;
 
+import org.apache.mina.core.bio.udp.BioUdpBenchmarkServer;
 import org.apache.mina.core.nio.tcp.Mina3TcpBenchmarkServer;
 import org.apache.mina.core.nio.tcp.Netty3TcpBenchmarkServer;
 import org.apache.mina.core.nio.udp.Mina3UdpBenchmarkServer;
@@ -44,6 +45,10 @@ public class BenchmarkServerFactory implements 
BenchmarkFactory<BenchmarkServer>
             return new Netty3TcpBenchmarkServer();
         case Netty3_udp:
             return new Netty3UdpBenchmarkServer();
+        case Bio_udp:
+            return new BioUdpBenchmarkServer();
+        case Bio_tcp:
+            //return new BioUdpBenchmarkClient();
         default:
             throw new IllegalArgumentException("Invalid type " + type);
         }

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
 
b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
index 57dd6ca..96d726e 100644
--- 
a/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
+++ 
b/benchmarks/src/test/java/org/apache/mina/core/Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest.java
@@ -58,7 +58,7 @@ public class Mina3ClientVsMina3ServerUdpBenchmarkBinaryTest 
extends BenchmarkBin
     public static Collection<Object[]> getParameters() {
         // Note : depending on your OS, the maximum PDU you can send can vary. 
See sysctl net.inet.udp.maxdgram
         Object[][] parameters = new Object[][] { 
-                { 1000000, 10, 2 * 60 }, 
+                { 1000000, 10, 2 * 60 },
                 { 1000000, 1 * 1024, 2 * 60 },
                 { 1000000, 2 * 1024, 2 * 60 }, 
                 { 1000000, 4 * 1024, 2 * 60 }, 

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/bio/udp/BioUdpBenchmarkClient.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/bio/udp/BioUdpBenchmarkClient.java
 
b/benchmarks/src/test/java/org/apache/mina/core/bio/udp/BioUdpBenchmarkClient.java
new file mode 100644
index 0000000..fe0c062
--- /dev/null
+++ 
b/benchmarks/src/test/java/org/apache/mina/core/bio/udp/BioUdpBenchmarkClient.java
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.core.bio.udp;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.mina.core.BenchmarkClient;
+
+/**
+ * A client that uses a BIO datagram to communicate with the server
+ * 
+ * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
+ */
+public class BioUdpBenchmarkClient implements BenchmarkClient {
+    // The UDP client
+    private DatagramSocket sender;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void start(int port, final CountDownLatch counter, final byte[] 
data) throws IOException {
+        InetAddress serverAddress = InetAddress.getLocalHost();
+        byte[] buffer = new byte[65507];
+        sender = new DatagramSocket(port + 1);
+
+        DatagramPacket pduSent = new DatagramPacket(data, data.length, 
serverAddress, port);
+        DatagramPacket pduReceived = new DatagramPacket(buffer, data.length);
+        sender.send(pduSent);
+
+        boolean done = false;
+
+        while (!done) {
+            try {
+                sender.receive(pduReceived);
+
+                for (int i = 0; i < pduReceived.getLength(); ++i) {
+                    counter.countDown();
+
+                    if (counter.getCount() > 0) {
+                        sender.send(pduSent);
+                        break;
+                    } else {
+                        done = true;
+                    }
+                }
+            } catch (IOException ioe) {
+                // Nothing to do
+            }
+        }
+
+        sender.close();
+    }
+
+    /**
+     * {@inheritedDoc}
+     */
+    public void stop() throws IOException {
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/nio/udp/BioUdpBenchmarkClient.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/BioUdpBenchmarkClient.java
 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/BioUdpBenchmarkClient.java
deleted file mode 100644
index 4bf3cfa..0000000
--- 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/BioUdpBenchmarkClient.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.core.nio.udp;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.mina.core.BenchmarkClient;
-
-/**
- * A client that uses a BIO datagram to communicate with the server
- * 
- * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
- */
-public class BioUdpBenchmarkClient implements BenchmarkClient {
-    // The UDP client
-    private DatagramSocket sender;
-
-    /**
-     * {@inheritDoc}
-     */
-    public void start(int port, final CountDownLatch counter, final byte[] 
data) throws IOException {
-        InetAddress serverAddress = InetAddress.getLocalHost();
-        byte[] buffer = new byte[65507];
-        sender = new DatagramSocket(port + 1);
-
-        DatagramPacket pduSent = new DatagramPacket(data, data.length, 
serverAddress, port);
-        DatagramPacket pduReceived = new DatagramPacket(buffer, data.length);
-        sender.send(pduSent);
-
-        boolean done = false;
-
-        while (!done) {
-            try {
-                sender.receive(pduReceived);
-
-                for (int i = 0; i < pduReceived.getLength(); ++i) {
-                    counter.countDown();
-
-                    if (counter.getCount() > 0) {
-                        sender.send(pduSent);
-                        break;
-                    } else {
-                        done = true;
-                    }
-                }
-            } catch (IOException ioe) {
-                // Nothing to do
-            }
-        }
-
-        sender.close();
-    }
-
-    /**
-     * {@inheritedDoc}
-     */
-    public void stop() throws IOException {
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkClient.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkClient.java
 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkClient.java
index 286dbf8..36d5568 100755
--- 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkClient.java
+++ 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkClient.java
@@ -34,6 +34,8 @@ import org.apache.mina.core.BenchmarkClient;
 import org.apache.mina.transport.nio.NioUdpClient;
 
 /**
+ * A MINA 3 based UDP client
+ * 
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 public class Mina3UdpBenchmarkClient implements BenchmarkClient {
@@ -52,6 +54,7 @@ public class Mina3UdpBenchmarkClient implements 
BenchmarkClient {
             }
 
             public void sessionOpened(IoSession session) {
+                System.out.println("Opened");
                 sendMessage(session, data);
             }
 

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkServer.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkServer.java
 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkServer.java
index cfb85cb..48b84b8 100755
--- 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkServer.java
+++ 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Mina3UdpBenchmarkServer.java
@@ -34,6 +34,8 @@ import org.apache.mina.transport.udp.DefaultUdpSessionConfig;
 import org.apache.mina.transport.udp.UdpSessionConfig;
 
 /**
+ * A MINA 3 based UDP server
+ * 
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 public class Mina3UdpBenchmarkServer implements BenchmarkServer {

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkClient.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkClient.java
 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkClient.java
index 33214f3..5881679 100644
--- 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkClient.java
+++ 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkClient.java
@@ -38,6 +38,7 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
 import org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory;
 
 /**
+ * A Netty 3 based UDP client
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 public class Netty3UdpBenchmarkClient implements BenchmarkClient {

http://git-wip-us.apache.org/repos/asf/mina/blob/87d54a21/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkServer.java
----------------------------------------------------------------------
diff --git 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkServer.java
 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkServer.java
index e1f41d0..3b04c96 100644
--- 
a/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkServer.java
+++ 
b/benchmarks/src/test/java/org/apache/mina/core/nio/udp/Netty3UdpBenchmarkServer.java
@@ -43,6 +43,8 @@ import org.jboss.netty.channel.group.DefaultChannelGroup;
 import org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory;
 
 /**
+ * A Netty 3 based UDP server
+ * 
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 public class Netty3UdpBenchmarkServer implements BenchmarkServer {

Reply via email to