activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1441813 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent: Threading.cpp Threading.h
Date Sat, 02 Feb 2013 22:03:38 GMT
Author: tabish
Date: Sat Feb  2 22:03:38 2013
New Revision: 1441813

URL: http://svn.apache.org/viewvc?rev=1441813&view=rev
Log:
Add a diagnostic method to dump out the current Threads to the console. 

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp?rev=1441813&r1=1441812&r2=1441813&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
Sat Feb  2 22:03:38 2013
@@ -870,6 +870,38 @@ void Threading::unlockThreadsLib() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void Threading::dumpRunningThreads() {
+    lockThreadsLib();
+
+    if (library == NULL) {
+        return;
+    }
+
+    std::list<ThreadHandle*>::const_iterator threads = library->activeThreads.begin();
+
+    std::cout << "------------------------------------------------------------------------"
<< std::endl;
+    std::cout << " Active Threads: " << library->activeThreads.size() <<
std::endl;
+    std::cout << " Wrapped OS Threads: " << library->osThreads.size() <<
std::endl;
+    std::cout << std::endl;
+
+    for(; threads != library->activeThreads.end(); ++threads) {
+        ThreadHandle* thread = *threads;
+
+        if (thread == NULL) {
+            continue;
+        }
+
+        std::string threadName = thread->name;
+
+        std::cout << "Thread name = " << threadName << std::endl;
+    }
+
+    std::cout << "------------------------------------------------------------------------"
<< std::endl;
+
+    unlockThreadsLib();
+}
+
+////////////////////////////////////////////////////////////////////////////////
 ThreadHandle* Threading::createNewThread(Thread* parent, const char* name, long long stackSize)
{
 
     if (parent == NULL || name == NULL) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.h?rev=1441813&r1=1441812&r2=1441813&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.h
Sat Feb  2 22:03:38 2013
@@ -67,6 +67,11 @@ namespace concurrent {
          */
         static void unlockThreadsLib();
 
+        /**
+         * Diagnostic method dumps all threads info to console.
+         */
+        static void dumpRunningThreads();
+
     public:  // Monitors
 
         /**



Mime
View raw message