13
0

Use DEBUG macros for SessionEvent debugging.

git-svn-id: svn://localhost/ardour2/branches/3.0@8482 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-01-08 15:19:32 +00:00
parent af0030a6de
commit bee34078e7
4 changed files with 19 additions and 5 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -40,6 +40,7 @@ namespace PBD {
extern uint64_t Stateful;
extern uint64_t Properties;
extern uint64_t FileManager;
extern uint64_t Pool;
}
}

View File

@ -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 ();