User: schulze
Date: 00/10/20 11:47:59
Modified: src/main/org/jboss/test/load/test Client.java Worker.java
Log:
fixed the time calculation
Revision Changes Path
1.4 +14 -9 jbosstest/src/main/org/jboss/test/load/test/Client.java
Index: Client.java
===================================================================
RCS file:
/products/cvs/ejboss/jbosstest/src/main/org/jboss/test/load/test/Client.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Client.java 2000/10/13 20:11:36 1.3
+++ Client.java 2000/10/20 18:47:58 1.4
@@ -22,7 +22,7 @@
* </dl>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a>
-* @version $Id: Client.java,v 1.3 2000/10/13 20:11:36 schulze Exp $
+* @version $Id: Client.java,v 1.4 2000/10/20 18:47:58 schulze Exp $
*/
public class Client
{
@@ -143,6 +143,7 @@
ThreadGroup threadGroup = new ThreadGroup ("workers");
Worker[] workers = new Worker[threads];
+ long start = System.currentTimeMillis();
// create and start threads...
for (int i = 0; i < threads; ++i)
{
@@ -161,7 +162,7 @@
{ // shoudnt happen...
}
}
-
+
// wait for all threads to finish... (is this the most elegant way?!)
try
{
@@ -172,11 +173,12 @@
catch (InterruptedException _ie){
System.out.print ("Main thread interrupted?!");
}
-
+ long timeSum = (System.currentTimeMillis() - start)/1000L;
+
// make statistic...
int failed = 0;
int tx = 0;
- int time = 0;
+ long timeAcc = 0;
for (int i = 0; i < threads; ++i)
{
Hashtable cfg = workers[i].getConfig ();
@@ -184,8 +186,9 @@
++failed;
tx += ((Integer)cfg.get("transactions")).intValue ();
- time += ((Integer)cfg.get("time")).intValue ();
+ //timeAcc += ((Long)cfg.get("time")).longValue ();
}
+ long txps = tx/timeSum;
System.out.println("------------------------------------------------------");
@@ -199,12 +202,14 @@
System.out.println("Congratulations the test succeeded! :-)");
System.out.println("All threads finished clean.");
}
+
- int h = time/3600;
- int m = (time-h*3600)/60;
+ long h = timeSum/3600L;
+ long m = (timeSum-h*3600L)/60L;
+ long s = timeSum-h*3600L-m*60L;
System.out.println("");
- System.out.println("statistic: "+tx+" transactions in "+h+" h "+m+" min.");
- System.out.println(" transactions per second: "+(tx/time));
+ System.out.println("statistic: "+tx+" transactions in "+h+" h "+m+" min "+s+"
s.");
+ System.out.println(" transactions per second (average): "+txps);
return failed;
}
1.3 +2 -2 jbosstest/src/main/org/jboss/test/load/test/Worker.java
Index: Worker.java
===================================================================
RCS file:
/products/cvs/ejboss/jbosstest/src/main/org/jboss/test/load/test/Worker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Worker.java 2000/10/13 20:11:36 1.2
+++ Worker.java 2000/10/20 18:47:58 1.3
@@ -17,7 +17,7 @@
* After completition the beans are removed on fail the beans are not removed.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Schulze</a>
-* @version $Id: Worker.java,v 1.2 2000/10/13 20:11:36 schulze Exp $
+* @version $Id: Worker.java,v 1.3 2000/10/20 18:47:58 schulze Exp $
*/
public class Worker
extends Thread
@@ -181,7 +181,7 @@
private void prepareExit (boolean _failed, int _transactions, long _start, long
_stop)
{
config.put ("transactions", new Integer (_transactions));
- config.put ("time", new Integer ((int)(_stop - _start) / 1000));
+ config.put ("time", new Long (_stop-_start));
config.put ("failed", new Boolean (_failed));
}