Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

IDEA::LockTrace Class Reference
[Utilities]

The (ACE) singleton class LockTrace traces the locking and unlocking of mutexes. Tracing the locking can be turned of by defining the identifier TRACE_LOCKS. TRACE_LOCKS can be defined with a -D command-line option for the compiler or with a define directive. More...

#include <LockTrace.hh>

Inheritance diagram for IDEA::LockTrace:

IDEA::Singleton< LockTrace > List of all members.

Public Methods

 ~LockTrace ()
 Destructor.

void lockInvoked (const std::string &locator, long lock)
 Prints a 'lock acquire invoked at' string in the log file with a counter and thread identifier. This is invoked when we try to lock a mutex but have not yet acquired the lock.

void lockAcquired (const std::string &locator, long lock)
 Prints a ' lock acquired at' string in the log file with a counter and thread identifier. This is invoked when we try to lock a mutex and acquired the lock.

void unLockInvoked (const std::string &locator, long lock)
 Prints a 'release invoked at' string in the log file with a counter and thread identifier. This is invoked when we try to unlock/release a mutex but have not yet released the lock.

void unLockReleased (const std::string &locator, long lock)
 Prints a 'lock released at' string in the log file with a counter and thread identifier. This is invoked when we try to unlock/release a mutex and just released the lock.


Static Public Methods

LockTrace * instance ()

Static Protected Methods

LockTrace *& getInstance ()
 The instance.

void release ()

Private Methods

 LockTrace ()
 Constructor, creates and opens a file name 'trace.log'.

void printTabs ()
 Streams a number of white spaces in the log depending on the value of m_Counter.


Private Attributes

std::fstream * m_Stream
 Counter to determine the number of locks requested to acquire or release.

ACE_Thread_Mutex m_Mutex
 Mutex for streaming the output of this class. This mutex is not being logged.


Static Private Attributes

int m_Counter = 0

Friends

class Singleton< LockTrace >

Detailed Description

The (ACE) singleton class LockTrace traces the locking and unlocking of mutexes. Tracing the locking can be turned of by defining the identifier TRACE_LOCKS. TRACE_LOCKS can be defined with a -D command-line option for the compiler or with a define directive.

The single global point of access to the instance of this class is TheLockTrace::instance() which returns a pointer to an instance of LockTrace.

If compiled with TRACE_LOCKS all the releases and acquiring of mutex locks are being logged in a file named trace.log. This trace mechanism has its own mutex which is not being traced.


Constructor & Destructor Documentation

IDEA::LockTrace::~LockTrace  
 

Destructor.

IDEA::LockTrace::LockTrace   [private]
 

Constructor, creates and opens a file name 'trace.log'.


Member Function Documentation

LockTrace*& IDEA::Singleton< LockTrace >::getInstance   [inline, static, protected, inherited]
 

The instance.

This pattern is used to prevent "static initialization order fiasco" (Google this for better understanding)

LockTrace* IDEA::Singleton< LockTrace >::instance   [inline, static, inherited]
 

void IDEA::LockTrace::lockAcquired const std::string &    locator,
long    lock
 

Prints a ' lock acquired at' string in the log file with a counter and thread identifier. This is invoked when we try to lock a mutex and acquired the lock.

void IDEA::LockTrace::lockInvoked const std::string &    locator,
long    lock
 

Prints a 'lock acquire invoked at' string in the log file with a counter and thread identifier. This is invoked when we try to lock a mutex but have not yet acquired the lock.

void IDEA::LockTrace::printTabs   [private]
 

Streams a number of white spaces in the log depending on the value of m_Counter.

void IDEA::Singleton< LockTrace >::release   [inline, static, protected, inherited]
 

void IDEA::LockTrace::unLockInvoked const std::string &    locator,
long    lock
 

Prints a 'release invoked at' string in the log file with a counter and thread identifier. This is invoked when we try to unlock/release a mutex but have not yet released the lock.

void IDEA::LockTrace::unLockReleased const std::string &    locator,
long    lock
 

Prints a 'lock released at' string in the log file with a counter and thread identifier. This is invoked when we try to unlock/release a mutex and just released the lock.


Friends And Related Function Documentation

friend class Singleton< LockTrace > [friend]
 


Member Data Documentation

int IDEA::LockTrace::m_Counter = 0 [static, private]
 

ACE_Thread_Mutex IDEA::LockTrace::m_Mutex [private]
 

Mutex for streaming the output of this class. This mutex is not being logged.

std::fstream* IDEA::LockTrace::m_Stream [private]
 

Counter to determine the number of locks requested to acquire or release.


Contact information
© IDEA
Generated on Fri Feb 3 17:09:45 2006 for IDEA.