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/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<uintptr_t>(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)

View File

@ -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 */
};
}