X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbctrace.h;h=8cf58285553d9ef8887d458e7e1e475c1faed4b6;hb=b55798fc64eee00c6fab3b4763e791befb7275f9;hp=5cbf0f53b494b88f0aff749d116ed93c154236ea;hpb=5a1b2bb96f2bd6b7ef4f8031763683726c02219d;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bctrace.h b/cinelerra-5.1/guicast/bctrace.h index 5cbf0f53..8cf58285 100644 --- a/cinelerra-5.1/guicast/bctrace.h +++ b/cinelerra-5.1/guicast/bctrace.h @@ -48,6 +48,9 @@ public: static void dump_locks(FILE *fp=stdout); static void dump_buffers(FILE *fp=stdout); static void dump_threads(FILE *fp=stdout); + + static void dump_shm_stat(const char *fn, FILE *fp=stdout); + static void dump_shm_stats(FILE *fp=stdout); }; class bc_trace_list : public List { @@ -131,7 +134,7 @@ public: this->loc = loc; this->is_owner = 0; this->id = table_id++; this->tid = pthread_self(); } - void clear() { + void clear() { this->info = 0; this->title = 0; this->loc = 0; this->is_owner = 0; this->id = -1; this->tid = 0; } @@ -179,19 +182,24 @@ public: void lock() { pthread_mutex_lock(&the_lock); } void unlock() { pthread_mutex_unlock(&the_lock); } - TheLock() { + void init() { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutex_init(&the_lock, &attr); } - ~TheLock() { + void finit() { pthread_mutex_destroy(&the_lock); } + void reset() { finit(); init(); } + + TheLock() { init(); } + ~TheLock() { finit(); } }; class TheLocker { public: static TheLock the_lock; + static void reset() { the_lock.reset(); } TheLocker() { the_lock.lock(); } ~TheLocker() { the_lock.unlock(); } @@ -211,28 +219,18 @@ public: static void dump_threads(FILE *fp); static void dbg_add(pthread_t tid, pthread_t owner, const char *nm); static void dbg_del(pthread_t tid); - - TheList() {} - ~TheList() { - TheLocker the_locker; - remove_all_objects(); - } -}; - -class TheChk { -public: - static TheChk the_chk; - - TheChk() {} - ~TheChk() { - int i = TheList::the_list.size(); + static void reset() { the_list.remove_all_objects(); TheLocker::reset(); } + void check() { + int i = the_list.size(); if( !i ) return; printf("unjoined tids / owner %d\n", i); while( --i >= 0 ) printf(" %016lx / %016lx %s\n", - (unsigned long)TheList::the_list[i]->tid, - (unsigned long)TheList::the_list[i]->owner, - TheList::the_list[i]->name); + (unsigned long)the_list[i]->tid, + (unsigned long)the_list[i]->owner, + the_list[i]->name); } + TheList() {} + ~TheList() { check(); reset(); } }; #endif