Remove obsolete mutex profiling code

refs #7622
This commit is contained in:
Gunnar Beutner 2014-11-13 05:47:48 +01:00
parent f592a13481
commit 6ef4e313d9
2 changed files with 1 additions and 62 deletions

View File

@ -18,7 +18,6 @@
******************************************************************************/ ******************************************************************************/
#include "base/thinmutex.hpp" #include "base/thinmutex.hpp"
#include "base/initialize.hpp"
#include "base/timer.hpp" #include "base/timer.hpp"
#include "base/convert.hpp" #include "base/convert.hpp"
#include "base/logger.hpp" #include "base/logger.hpp"
@ -26,32 +25,6 @@
using namespace icinga; using namespace icinga;
#ifdef _DEBUG
uintptr_t ThinMutex::m_TotalMutexes;
uintptr_t ThinMutex::m_InflatedMutexes;
uintptr_t ThinMutex::m_DeadMutexes;
static Timer::Ptr l_Timer;
void ThinMutex::DebugTimerHandler(void)
{
Log(LogNotice, "ThinMutex")
<< "Mutexes: " << ThinMutex::m_TotalMutexes - ThinMutex::m_DeadMutexes
<< ", Inflated Mutexes: " << ThinMutex::m_InflatedMutexes
<< ", Dead Mutexes: " << ThinMutex::m_DeadMutexes;
}
static void InitThinMutex(void)
{
l_Timer = new Timer();
l_Timer->SetInterval(10);
l_Timer->OnTimerExpired.connect(boost::bind(&ThinMutex::DebugTimerHandler));
l_Timer->Start();
}
INITIALIZE_ONCE(&InitThinMutex);
#endif /* _DEBUG */
void ThinMutex::LockSlowPath(void) void ThinMutex::LockSlowPath(void)
{ {
LockSlowPath(false); LockSlowPath(false);
@ -98,14 +71,6 @@ void ThinMutex::MakeNative(void)
#else /* _WIN32 */ #else /* _WIN32 */
__sync_bool_compare_and_swap(&m_Data, THINLOCK_LOCKED, reinterpret_cast<uintptr_t>(mtx)); __sync_bool_compare_and_swap(&m_Data, THINLOCK_LOCKED, reinterpret_cast<uintptr_t>(mtx));
#endif /* _WIN32 */ #endif /* _WIN32 */
#ifdef _DEBUG
# ifdef _WIN32
InterlockedIncrement(&m_InflatedMutexes);
# else /* _WIN32 */
__sync_fetch_and_add(&m_InflatedMutexes, 1);
# endif /* _WIN32 */
#endif /* _DEBUG */
} }
void ThinMutex::DestroyNative(void) void ThinMutex::DestroyNative(void)

View File

@ -43,28 +43,12 @@ class I2_BASE_API ThinMutex
public: public:
inline ThinMutex(void) inline ThinMutex(void)
: m_Data(THINLOCK_UNLOCKED) : m_Data(THINLOCK_UNLOCKED)
{ { }
#ifdef _DEBUG
# ifdef _WIN32
InterlockedIncrement(&m_TotalMutexes);
# else /* _WIN32 */
__sync_fetch_and_add(&m_TotalMutexes, 1);
# endif /* _WIN32 */
#endif /* _DEBUG */
}
inline ~ThinMutex(void) inline ~ThinMutex(void)
{ {
if (m_Data > THINLOCK_LOCKED) if (m_Data > THINLOCK_LOCKED)
DestroyNative(); DestroyNative();
#ifdef _DEBUG
# ifdef _WIN32
InterlockedDecrement(&m_TotalMutexes);
# else /* _WIN32 */
__sync_fetch_and_add(&m_DeadMutexes, 1);
# endif /* _WIN32 */
#endif /* _DEBUG */
} }
inline void Lock(bool make_native = false) inline void Lock(bool make_native = false)
@ -105,10 +89,6 @@ public:
Unlock(); Unlock();
} }
#ifdef _DEBUG
static void DebugTimerHandler(void);
#endif /* _DEBUG */
private: private:
inline void Spin(unsigned int it) inline void Spin(unsigned int it)
{ {
@ -145,12 +125,6 @@ private:
#else /* _WIN32 */ #else /* _WIN32 */
uintptr_t m_Data; uintptr_t m_Data;
#endif /* _WIN32 */ #endif /* _WIN32 */
#ifdef _DEBUG
static uintptr_t m_TotalMutexes;
static uintptr_t m_InflatedMutexes;
static uintptr_t m_DeadMutexes;
#endif /* _DEBUG */
}; };
} }