activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1031850 - /activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala
Date Fri, 05 Nov 2010 22:12:36 GMT
Author: chirino
Date: Fri Nov  5 22:12:35 2010
New Revision: 1031850

URL: http://svn.apache.org/viewvc?rev=1031850&view=rev
Log:
If hawtdispatch profiling is enabled, then periodically dump it's stats to the console.

Modified:
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala?rev=1031850&r1=1031849&r2=1031850&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala
Fri Nov  5 22:12:35 2010
@@ -23,6 +23,7 @@ import org.mortbay.jetty.nio.SelectChann
 import org.mortbay.jetty.webapp.WebAppContext
 import org.apache.commons.logging.LogFactory
 import java.io.File
+import org.fusesource.hawtdispatch.DispatchProfiler
 
 /**
  * <p>
@@ -59,7 +60,35 @@ object Main {
         return
       }
     }
-    
+
+    if(java.lang.Boolean.getBoolean("hawtdispatch.profile")) {
+      new Thread("HawtDispatch Monitor") {
+        setDaemon(true);
+        override def run = {
+          while(true) {
+            Thread.sleep(1000);
+            import collection.JavaConversions._
+
+            // Only display is we see some long wait or run times..
+            val m = DispatchProfiler.metrics.toList.flatMap{x=>
+              if( x.total_wait_time_ns > 1000000 ||  x.total_run_time_ns > 1000000
) {
+                Some(x)
+              } else {
+                None
+              }
+            }
+
+            if( !m.isEmpty ) {
+              println("-- hawtdispatch metrics -----------------------")
+              m.foreach{ metric=>
+                println(metric)
+              }
+            }
+          }
+        }
+      }.start();
+    }
+
     println("===========================")
     println("Starting up ActiveMQ Apollo");
     println("===========================")



Mime
View raw message