commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/tool StopWatchMessageListener.java
Date Mon, 11 Nov 2002 12:37:08 GMT
jstrachan    2002/11/11 04:37:08

  Modified:    messenger/src/java/org/apache/commons/messenger/tool
                        StopWatchMessageListener.java
  Log:
  fixed schoolboy error on the stop watch MessageListener which now prints accurate results
since double precision arithmetic is used to avoid rounding errors
  
  Revision  Changes    Path
  1.4       +5 -2      jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/tool/StopWatchMessageListener.java
  
  Index: StopWatchMessageListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/tool/StopWatchMessageListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StopWatchMessageListener.java	12 Jul 2002 07:41:16 -0000	1.3
  +++ StopWatchMessageListener.java	11 Nov 2002 12:37:08 -0000	1.4
  @@ -60,8 +60,11 @@
       
           if ( ++count == groupSize ) {
               long elapsed = System.currentTimeMillis() - startTime;            
  -            double timePerMessage = elapsed / count;
  -            double messagesPerSecond = groupSize / timePerMessage;
  +            double timePerMessage = elapsed;
  +            timePerMessage /= count;
  +            
  +            double messagesPerSecond = groupSize; 
  +            messagesPerSecond /= timePerMessage;
               
               Destination destination = null;
               try {
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message