[#BloombergLP-bslmt-MeteredMutex] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::MeteredMutex :relfileprefix: ../../ :mrdocs: Mutex that tracks cumulative hold time and wait time. == Synopsis Declared in `<bslmt_meteredmutex.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/MeteredMutex/2constructor.adoc[`MeteredMutex`] [.small]#[constructor]# | Create a metered mutex in the unlocked state. | xref:BloombergLP/bslmt/MeteredMutex/2destructor.adoc[`~MeteredMutex`] [.small]#[destructor]# | Destroy this metered mutex. | xref:BloombergLP/bslmt/MeteredMutex/holdTime.adoc[`holdTime`] | Return the hold time (in nanoseconds) accumulated since the most recent call to `resetMetrics` (or `MeteredMutex` if `resetMetrics` was never called). | xref:BloombergLP/bslmt/MeteredMutex/lastResetTime.adoc[`lastResetTime`] | Return the time of the most recent metrics reset. | xref:BloombergLP/bslmt/MeteredMutex/lock.adoc[`lock`] | Acquire the lock on this metered mutex. | xref:BloombergLP/bslmt/MeteredMutex/resetMetrics.adoc[`resetMetrics`] | Reset the wait and hold time to zero and record the current time. | xref:BloombergLP/bslmt/MeteredMutex/tryLock.adoc[`tryLock`] | Attempt to acquire the lock on this metered mutex. | xref:BloombergLP/bslmt/MeteredMutex/unlock.adoc[`unlock`] | Release the lock on this mutex that was previously acquired through a successful call to `lock` or `tryLock`. | xref:BloombergLP/bslmt/MeteredMutex/waitTime.adoc[`waitTime`] | Return accumulated wait time since the last metrics reset. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#