activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r961183 - /activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompLoadClient.scala
Date Wed, 07 Jul 2010 04:14:39 GMT
Author: chirino
Date: Wed Jul  7 04:14:39 2010
New Revision: 961183

URL: http://svn.apache.org/viewvc?rev=961183&view=rev
Log:
include total transfered in client stats.

Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompLoadClient.scala

Modified: activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompLoadClient.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompLoadClient.scala?rev=961183&r1=961182&r2=961183&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompLoadClient.scala
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompLoadClient.scala
Wed Jul  7 04:14:39 2010
@@ -90,6 +90,8 @@ object StompLoadClient {
     val sampleThread = new Thread() {
       override def run() = {
         try {
+          var totalProducerCount = 0L
+          var totalConsumerCount = 0L
           producerCounter.set(0)
           consumerCounter.set(0)
           var start = System.nanoTime()
@@ -97,10 +99,14 @@ object StompLoadClient {
             Thread.sleep(sampleInterval)
             val end = System.nanoTime()
             if( producers > 0 ) {
-              printRate("Producer", producerCounter, end - start)
+              val count = producerCounter.getAndSet(0)
+              totalProducerCount += count
+              printRate("Producer", count, totalProducerCount, end - start)
             }
             if( consumers > 0 ) {
-              printRate("Consumer", consumerCounter, end - start)
+              val count = consumerCounter.getAndSet(0)
+              totalConsumerCount += count
+              printRate("Consumer", count, totalConsumerCount, end - start)
             }
             start = end
           }
@@ -158,10 +164,9 @@ object StompLoadClient {
 
   }
 
-  def printRate(name: String, counter: AtomicLong, nanos: Long) = {
-    val c = counter.getAndSet(0)
-    val rate_per_second: java.lang.Float = ((1.0f * c / nanos) * NANOS_PER_SECOND)
-    println(format("%s rate: %,.3f per second", name, rate_per_second))
+  def printRate(name: String, periodCount:Long, totalCount:Long, nanos: Long) = {
+    val rate_per_second: java.lang.Float = ((1.0f * periodCount / nanos) * NANOS_PER_SECOND)
+    println("%s rate: %,.3f per second, total: %,d".format(name, rate_per_second, totalCount))
   }
 
   def destination(i:Int) = "/"+destinationType+"/load-"+(i%destinationCount)



Mime
View raw message