Mutex that tracks cumulative hold time and wait time.

Synopsis

Declared in <bslmt_meteredmutex.h>

class MeteredMutex;

Description

This class implements a mutex, that has the additional capability to keep track of hold time and wait time. The hold time is defined as the cumulative duration for which the mutex was in the locked state. The wait time is defined as the duration for which threads waited for the mutex.

Member Functions

Name

Description

MeteredMutex [constructor]

Create a metered mutex in the unlocked state.

~MeteredMutex [destructor]

Destroy this metered mutex.

holdTime

Return the hold time (in nanoseconds) accumulated since the most recent call to resetMetrics (or MeteredMutex if resetMetrics was never called).

lastResetTime

Return the time of the most recent metrics reset.

lock

Acquire the lock on this metered mutex.

resetMetrics

Reset the wait and hold time to zero and record the current time.

tryLock

Attempt to acquire the lock on this metered mutex.

unlock

Release the lock on this mutex that was previously acquired through a successful call to lock or tryLock.

waitTime

Return accumulated wait time since the last metrics reset.

Created with MrDocs