diff options
-rw-r--r-- | libs/ardour/session_events.cc | 15 | ||||
-rw-r--r-- | libs/pbd/debug.cc | 1 | ||||
-rw-r--r-- | libs/pbd/pbd/debug.h | 1 | ||||
-rw-r--r-- | libs/pbd/pool.cc | 7 |
4 files changed, 19 insertions, 5 deletions
diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index c50ba1e68a..df47cd5baf 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -61,7 +61,7 @@ SessionEvent::operator new (size_t) { CrossThreadPool* p = pool->per_thread_pool (); SessionEvent* ev = static_cast<SessionEvent*> (p->alloc ()); - cerr << pthread_self() << " Allocating SessionEvent from " << p->name() << " ev @ " << ev << endl; + DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3\n", pthread_self(), p->name(), ev)); ev->own_pool = p; return ev; } @@ -72,8 +72,17 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/) Pool* p = pool->per_thread_pool (); SessionEvent* ev = static_cast<SessionEvent*> (ptr); - cerr << pthread_self() << " Deleting SessionEvent @ " << ev << " thread pool = " << p->name() << " ev pool = " << ev->own_pool->name() << endl; - stacktrace (cerr, 20); + DEBUG_TRACE (DEBUG::SessionEvents, string_compose ( + "%1 Deleting SessionEvent @ %2 ev thread pool = %3 ev pool = %4\n", + pthread_self(), ev, p->name(), ev->own_pool->name() + )); + +#ifdef NDEBUG + if (DEBUG::SessionEvents & PBD::debug_bits) { + stacktrace (cerr, 20); + } +#endif + if (p == ev->own_pool) { p->release (ptr); } else { diff --git a/libs/pbd/debug.cc b/libs/pbd/debug.cc index 4f97ccff86..e7ec767f87 100644 --- a/libs/pbd/debug.cc +++ b/libs/pbd/debug.cc @@ -33,6 +33,7 @@ static std::map<const char*,uint64_t> _debug_bit_map; uint64_t PBD::DEBUG::Stateful = PBD::new_debug_bit ("stateful"); uint64_t PBD::DEBUG::Properties = PBD::new_debug_bit ("properties"); uint64_t PBD::DEBUG::FileManager = PBD::new_debug_bit ("filemanager"); +uint64_t PBD::DEBUG::Pool = PBD::new_debug_bit ("pool"); uint64_t PBD::debug_bits = 0x0; diff --git a/libs/pbd/pbd/debug.h b/libs/pbd/pbd/debug.h index d3ce495a1b..8245b99b12 100644 --- a/libs/pbd/pbd/debug.h +++ b/libs/pbd/pbd/debug.h @@ -40,6 +40,7 @@ namespace PBD { extern uint64_t Stateful; extern uint64_t Properties; extern uint64_t FileManager; + extern uint64_t Pool; } } diff --git a/libs/pbd/pool.cc b/libs/pbd/pool.cc index c58f0d1071..8919f10f9a 100644 --- a/libs/pbd/pool.cc +++ b/libs/pbd/pool.cc @@ -26,6 +26,8 @@ #include "pbd/pool.h" #include "pbd/error.h" +#include "pbd/debug.h" +#include "pbd/compose.h" using namespace std; using namespace PBD; @@ -246,9 +248,10 @@ void* CrossThreadPool::alloc () { void* ptr; - cerr << pthread_self() << ' ' << name() << " has " << pending.read_space() << " pending free entries waiting\n"; + + DEBUG_TRACE (DEBUG::Pool, string_compose ("%1 %2 has %3 pending free entries waiting\n", pthread_self(), name(), pending.read_space())); while (pending.read (&ptr, 1) == 1) { - cerr << pthread_self() << ' ' << name() << " pushes back a pending free list entry before allocating\n"; + DEBUG_TRACE (DEBUG::Pool, string_compose ("%1 %2 pushes back a pending free list entry before allocating\n", pthread_self(), name())); free_list.write (&ptr, 1); } return Pool::alloc (); |