[jboss-cvs] JBossAS SVN: r68650 - in projects/cluster/varia/sessionstress: lib and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 7 06:08:50 EST 2008


Author: bela at jboss.com
Date: 2008-01-07 06:08:50 -0500 (Mon, 07 Jan 2008)
New Revision: 68650

Removed:
   projects/cluster/varia/sessionstress/lib/jgroups.jar
Modified:
   projects/cluster/varia/sessionstress/PerfTest.java
Log:
removed JGroups JAR

Modified: projects/cluster/varia/sessionstress/PerfTest.java
===================================================================
--- projects/cluster/varia/sessionstress/PerfTest.java	2008-01-07 09:43:42 UTC (rev 68649)
+++ projects/cluster/varia/sessionstress/PerfTest.java	2008-01-07 11:08:50 UTC (rev 68650)
@@ -3,14 +3,13 @@
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.GetMethod;
-import org.jgroups.util.Util;
 
 import javax.naming.NamingException;
 import java.io.IOException;
+import java.text.NumberFormat;
 import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.TimeUnit;
-import java.text.NumberFormat;
 
 /**
  * @author Bela Ban
@@ -78,12 +77,50 @@
        
         System.out.println("Successful reads: " + total_successful_reads + ", successful writes: " + total_successful_writes);
         System.out.println("Failed reads: " + total_failed_reads + ", failed writes: " + total_failed_writes);
-        System.out.println("Bytes read: " + Util.printBytes(total_bytes_read) + ", bytes written: " + Util.printBytes(total_bytes_written));
-        System.out.println("Bytes read/sec: " + Util.printBytes(total_bytes_read / (avg_time / 1000.0)) + ", bytes written/sec: " +
-                Util.printBytes(total_bytes_written / (avg_time / 1000.0)));
+        System.out.println("Bytes read: " + printBytes(total_bytes_read) + ", bytes written: " + printBytes(total_bytes_written));
+        System.out.println("Bytes read/sec: " + printBytes(total_bytes_read / (avg_time / 1000.0)) + ", bytes written/sec: " +
+                printBytes(total_bytes_written / (avg_time / 1000.0)));
         System.out.println("Total client: " + num_clients + ", failed clients: " + failed_clients);
     }
 
+    private static String printBytes(long bytes) {
+        double tmp;
+
+        if(bytes < 1000)
+            return bytes + "b";
+        if(bytes < 1000000) {
+            tmp=bytes / 1000.0;
+            return f.format(tmp) + "KB";
+        }
+        if(bytes < 1000000000) {
+            tmp=bytes / 1000000.0;
+            return f.format(tmp) + "MB";
+        }
+        else {
+            tmp=bytes / 1000000000.0;
+            return f.format(tmp) + "GB";
+        }
+    }
+
+    public static String printBytes(double bytes) {
+        double tmp;
+
+        if(bytes < 1000)
+            return bytes + "b";
+        if(bytes < 1000000) {
+            tmp=bytes / 1000.0;
+            return f.format(tmp) + "KB";
+        }
+        if(bytes < 1000000000) {
+            tmp=bytes / 1000000.0;
+            return f.format(tmp) + "MB";
+        }
+        else {
+            tmp=bytes / 1000000000.0;
+            return f.format(tmp) + "GB";
+        }
+    }
+
    
 
     public static void main(String[] args) throws Exception {
@@ -265,8 +302,8 @@
             int rc, total=0;
 
             for(int i=0; i < num_requests; i++) {
-                random=(int)Util.random(100);
-                id=(int)Util.random(num_attrs -1);
+                random=(int)random(100);
+                id=(int)random(num_attrs -1);
                 if(random <= read_percentage) { // read
                     read_method=new GetMethod(read_url + id);
                     try {
@@ -316,7 +353,14 @@
             System.err.println(tmp);
         }
 
+        private static long random(long range) {
+            return (long)((Math.random() * 100000) % range) + 1;
+        }
 
+
+
+
+
     }
 
 

Deleted: projects/cluster/varia/sessionstress/lib/jgroups.jar
===================================================================
(Binary files differ)




More information about the jboss-cvs-commits mailing list