remove poorly-conceived pstats timers around mutex

This commit is contained in:
David Rose 2006-04-11 22:09:24 +00:00
parent 7b22b83733
commit 5dc152c010
2 changed files with 1 additions and 42 deletions

View File

@ -22,9 +22,6 @@
#ifdef DEBUG_THREADS
MutexDebug::VoidFunc *MutexDebug::_pstats_wait_start;
MutexDebug::VoidFunc *MutexDebug::_pstats_wait_stop;
MutexImpl MutexDebug::_global_mutex;
////////////////////////////////////////////////////////////////////
@ -71,24 +68,6 @@ output(ostream &out) const {
}
}
////////////////////////////////////////////////////////////////////
// Function: MutexDebug::set_pstats_callbacks
// Access: Public, Static
// Description: This special function exists to provide hooks into
// the PStatClient system, so we can time the amount of
// time we spend waiting for a mutex lock (if the user
// configures this on). We have to do this nutty void
// function callback thing, because PStats is defined in
// a later module (it depends on this module, because it
// needs to use mutex locks, of course).
////////////////////////////////////////////////////////////////////
void MutexDebug::
set_pstats_callbacks(MutexDebug::VoidFunc *wait_start,
MutexDebug::VoidFunc *wait_stop) {
_pstats_wait_start = wait_start;
_pstats_wait_stop = wait_stop;
}
////////////////////////////////////////////////////////////////////
// Function: MutexDebug::do_lock
// Access: Private
@ -124,11 +103,6 @@ do_lock() {
} else {
// The mutex is locked by some other thread.
#ifdef DO_PSTATS
if (_pstats_wait_start != NULL) {
(*_pstats_wait_start)();
}
#endif // DO_PSTATS
// Check for deadlock.
MutexDebug *next_mutex = this;
@ -138,12 +112,6 @@ do_lock() {
report_deadlock(this_thread);
nassert_raise("Deadlock");
#ifdef DO_PSTATS
if (_pstats_wait_stop != NULL) {
(*_pstats_wait_stop)();
}
#endif // DO_PSTATS
_global_mutex.release();
return;
}
@ -184,13 +152,7 @@ do_lock() {
_locking_thread = this_thread;
++_lock_count;
nassertv(_lock_count == 1);
#ifdef DO_PSTATS
if (_pstats_wait_stop != NULL) {
(*_pstats_wait_stop)();
}
#endif // DO_PSTATS
}
}
}
////////////////////////////////////////////////////////////////////

View File

@ -49,7 +49,6 @@ public:
virtual void output(ostream &out) const;
typedef void VoidFunc();
static void set_pstats_callbacks(VoidFunc *wait_start, VoidFunc *wait_stop);
private:
void do_lock();
@ -65,8 +64,6 @@ private:
int _lock_count;
ConditionVarImpl _cvar;
static VoidFunc *_pstats_wait_start, *_pstats_wait_stop;
static MutexImpl _global_mutex;
friend class ConditionVarDebug;