add DEBUG::ProcessThreads as a debug tag for parallelization (probably to be renamed)
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 3 Jun 2010 21:28:02 +0000 (21:28 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 3 Jun 2010 21:28:02 +0000 (21:28 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7229 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/debug.h
libs/ardour/debug.cc
libs/ardour/graph.cc

index 1cd8854feaa6e92f450d617800fc8b935dd4d56c..43fb468b7af66cd1c96801e6eada9f94db5c0e2f 100644 (file)
@@ -35,6 +35,7 @@ namespace PBD {
                 extern uint64_t Configuration;
                 extern uint64_t Latency;
                 extern uint64_t Processors;
+                extern uint64_t ProcessThreads;
                 extern uint64_t Graph;
                 extern uint64_t Destruction;
                 extern uint64_t MTC;
index 419579b977dfeeaa7fc824c3da400d2b32d56890..7ddb6ddcc8d673b86cdcd74f68803c10995e4dcd 100644 (file)
@@ -32,6 +32,7 @@ uint64_t PBD::DEBUG::SnapBBT = PBD::new_debug_bit ("snapbbt");
 uint64_t PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration");
 uint64_t PBD::DEBUG::Latency = PBD::new_debug_bit ("latency");
 uint64_t PBD::DEBUG::Processors = PBD::new_debug_bit ("processors");
+uint64_t PBD::DEBUG::ProcessThreads = PBD::new_debug_bit ("processthreads");
 uint64_t PBD::DEBUG::Graph = PBD::new_debug_bit ("graph");
 uint64_t PBD::DEBUG::Destruction = PBD::new_debug_bit ("destruction");
 uint64_t PBD::DEBUG::MTC = PBD::new_debug_bit ("mtc");
index 3c5fcc64f0e5f22822cd5c01074e55985f31678c..bd4a5fab3138948e9345aaf04410dbf7192f6e79 100644 (file)
@@ -17,6 +17,9 @@
 
 */
 
+#include "pbd/compose.h"
+
+#include "ardour/debug.h"
 #include "ardour/graph.h"
 #include "ardour/types.h"
 #include "ardour/session.h"
@@ -39,6 +42,7 @@
 #include <cmath>
 
 using namespace ARDOUR;
+using namespace PBD;
 
 static    unsigned int hardware_concurrency()
     {
@@ -76,7 +80,7 @@ Graph::Graph( Session & session )
     _graph_empty = true;
 
     int num_cpu = hardware_concurrency();
-    printf( "found %d cpus\n", num_cpu );
+    DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("Using %1 CPUs via %1 threads\n", num_cpu));
     _thread_list.push_back( Glib::Thread::create( sigc::mem_fun( *this, &Graph::main_thread ), 100000, true, true, Glib::THREAD_PRIORITY_NORMAL ) );
     for (int i=1; i<num_cpu; i++)
         _thread_list.push_back( Glib::Thread::create( sigc::mem_fun( *this, &Graph::helper_thread ), 100000, true, true, Glib::THREAD_PRIORITY_NORMAL ) );
@@ -305,11 +309,11 @@ Graph::run_one()
     {
        _execution_tokens += 1;
        pthread_mutex_unlock( &_trigger_mutex );
-       //printf( "going to sleep...\n" ); 
+        DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 goes to sleep\n", pthread_self()));
        sem_wait( &_execution_sem );
         if (_quit_threads)
             return true;
-       //printf( "wake up...\n" ); 
+        DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 is awake\n", pthread_self()));
        pthread_mutex_lock( &_trigger_mutex );
        if (_trigger_queue.size())
        {
@@ -386,6 +390,7 @@ again:
 void
 Graph::dump( int chain )
 {
+#ifndef NDEBUG
     node_list_t::iterator ni;
     node_set_t::iterator ai;
 
@@ -409,6 +414,7 @@ Graph::dump( int chain )
     }
 
     printf( "final activation refcount: %d\n", _init_finished_refcount[chain] );
+#endif
 }
 
 int
@@ -490,6 +496,8 @@ Graph::process_one_route( Route * route )
 
     assert( route );
 
+    DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_self(), route->name()));
+
     if (_process_silent)
        retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_can_record, _process_rec_monitors_input, need_butler);
     else if (_process_noroll)