From 6ef4e313d9aed571e980da19fc0c6096a08ab898 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 13 Nov 2014 05:47:48 +0100 Subject: [PATCH] Remove obsolete mutex profiling code refs #7622 --- lib/base/thinmutex.cpp | 35 ----------------------------------- lib/base/thinmutex.hpp | 28 +--------------------------- 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/lib/base/thinmutex.cpp b/lib/base/thinmutex.cpp index 4276b1a69..fb8ac49cf 100644 --- a/lib/base/thinmutex.cpp +++ b/lib/base/thinmutex.cpp @@ -18,7 +18,6 @@ ******************************************************************************/ #include "base/thinmutex.hpp" -#include "base/initialize.hpp" #include "base/timer.hpp" #include "base/convert.hpp" #include "base/logger.hpp" @@ -26,32 +25,6 @@ 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) { LockSlowPath(false); @@ -98,14 +71,6 @@ void ThinMutex::MakeNative(void) #else /* _WIN32 */ __sync_bool_compare_and_swap(&m_Data, THINLOCK_LOCKED, reinterpret_cast(mtx)); #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) diff --git a/lib/base/thinmutex.hpp b/lib/base/thinmutex.hpp index b560f8f5a..0379f9819 100644 --- a/lib/base/thinmutex.hpp +++ b/lib/base/thinmutex.hpp @@ -43,28 +43,12 @@ class I2_BASE_API ThinMutex public: inline ThinMutex(void) : 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) { if (m_Data > THINLOCK_LOCKED) 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) @@ -105,10 +89,6 @@ public: Unlock(); } -#ifdef _DEBUG - static void DebugTimerHandler(void); -#endif /* _DEBUG */ - private: inline void Spin(unsigned int it) { @@ -145,12 +125,6 @@ private: #else /* _WIN32 */ uintptr_t m_Data; #endif /* _WIN32 */ - -#ifdef _DEBUG - static uintptr_t m_TotalMutexes; - static uintptr_t m_InflatedMutexes; - static uintptr_t m_DeadMutexes; -#endif /* _DEBUG */ }; }