tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r407787 - in /tomcat/container/tc5.5.x/modules/groupcom: src/share/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java test/java/org/apache/catalina/tribes/demos/LoadTest.java
Date Fri, 19 May 2006 12:59:20 GMT
Author: fhanik
Date: Fri May 19 05:59:20 2006
New Revision: 407787

URL: http://svn.apache.org/viewvc?rev=407787&view=rev
Log:
Added throughput measurement to the receiving end

Modified:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
    tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/demos/LoadTest.java

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java?rev=407787&r1=407786&r2=407787&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
Fri May 19 05:59:20 2006
@@ -47,12 +47,13 @@
     AtomicLong msgTxErr = new AtomicLong(0);
     int interval = 10000;
     AtomicInteger access = new AtomicInteger(0);
-    long start = 0;
+    long txStart = 0;
+    long rxStart = 0;
     DecimalFormat df = new DecimalFormat("#0.00");
 
 
     public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload
payload) throws ChannelException {
-        if ( access.addAndGet(1) == 1 ) start = System.currentTimeMillis();
+        if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
         long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
         try {
             super.sendMessage(destination, msg, payload);
@@ -65,7 +66,7 @@
         mbAppTx += ((double)(bytes))/(1024d*1024d);
         if ( access.addAndGet(-1) == 0 ) {
             long stop = System.currentTimeMillis();
-            timeTx += ( (double) (stop - start)) / 1000d;
+            timeTx += ( (double) (stop - txStart)) / 1000d;
         }
 
         if (msgTxCnt.get() % interval == 0) {
@@ -73,7 +74,7 @@
 
             if ( access.get() != 0 ) {
                 long now = System.currentTimeMillis();
-                time = (double)(now - start + timeTx)/1000d;
+                time = (double)(now - txStart + timeTx)/1000d;
             }
             report(time);
         }
@@ -81,6 +82,7 @@
     }
 
     public void messageReceived(ChannelMessage msg) {
+        if ( rxStart == 0 ) rxStart = System.currentTimeMillis();
         long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
         mbRx += ((double)bytes)/(1024d*1024d);
         msgRxCnt.addAndGet(1);
@@ -97,14 +99,16 @@
         buf.append(df.format(mbAppTx));
         buf.append(" MB (application)\n\tTime:");
         buf.append(df.format(timeTx));
-        buf.append(" seconds\n\tSpeed:");
+        buf.append(" seconds\n\tTx Speed:");
         buf.append(df.format(mbTx/timeTx));
-        buf.append(" MB/sec (total)\n\tSpeed:");
+        buf.append(" MB/sec (total)\n\tTxSpeed:");
         buf.append(df.format(mbAppTx/timeTx));
         buf.append(" MB/sec (application)\n\tError Msg:");
         buf.append(msgTxErr).append("\n\tRx Msg:");
         buf.append(msgRxCnt);
-        buf.append(" messages\n\tReceived:");
+        buf.append(" messages\n\tRx Speed:");
+        buf.append(mbRx/((double)((System.currentTimeMillis()-rxStart)/1000)));
+        buf.append(" MB/sec (since 1st msg)\n\tReceived:");
         buf.append(df.format(mbRx)).append(" MB]\n");
         if ( log.isInfoEnabled() ) log.info(buf);
     }

Modified: tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/demos/LoadTest.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/demos/LoadTest.java?rev=407787&r1=407786&r2=407787&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/demos/LoadTest.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/demos/LoadTest.java
Fri May 19 05:59:20 2006
@@ -249,8 +249,8 @@
 
     
     
-    //public static class LoadMessage extends ByteMessage implements Serializable  {
-    public static class LoadMessage extends ByteMessage  implements Serializable {
+    public static class LoadMessage implements Serializable  {
+    //public static class LoadMessage extends ByteMessage  implements Serializable {
         
         public static byte[] outdata = new byte[size];
         public static Random r = new Random(System.currentTimeMillis());
@@ -265,15 +265,13 @@
             }
             return messageSize;
         }
-        
-        protected byte[] message = getMessage();
-        protected int nr = -1;
         static {
             r.nextBytes(outdata);
         }
         
+        protected byte[] message = getMessage();
+        
         public LoadMessage() {
-            
         }
         
         public byte[] getMessage() {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message