carb::profiler::ProfiledSharedMutex

Defined in carb/profiler/Profile.h

template<class Mutex>
class ProfiledSharedMutex : public carb::profiler::ProfiledMutex<Mutex>

Wrapper to add automatic profiling to a shared mutex.

Public Functions

inline ProfiledSharedMutex(const uint64_t profileMask, const char *name)

Constructor.

Parameters
  • profileMask – The mask used to determine if events from this mutex are captured.

  • name – The name of the mutex

inline ProfiledSharedMutex(const carb::profiler::Channel &channel, const char *name)

Constructor.

Parameters
  • channel – The profiling channel used to determine if events from this mutex are captured.

  • name – The name of the mutex

inline ~ProfiledSharedMutex()

Destructor.

inline void lock_shared()

Locks the underlying mutex (shared) and reports the event to the profiler.

inline bool try_lock_shared()

Attempts a shared lock on the underlying mutex and reports the event to the profiler if successful.

Returns

true if successfully locked; false otherwise.

inline void unlock_shared()

Unlocks (shared) the underlying mutex and reports the event to the profiler.

inline void lock()

Locks the underlying mutex and reports the event to the profiler.

inline bool try_lock()

Attempts a lock on the underlying mutex and reports the event to the profiler if successful.

Returns

true if successfully locked; false otherwise.

inline void unlock()

Unlocks the underlying mutex and reports the event to the profiler.

inline Mutex &getMutex()

Returns a reference to the underlying mutex.

Returns

a reference to the underlying mutex.

inline const Mutex &getMutex() const

Returns a reference to the underlying mutex.

Returns

a reference to the underlying mutex.

Protected Attributes

Mutex m_mutex

The underlying mutex instance.

LockableId m_lockableId

The lockable ID as returned by carb::profiler::IProfiler::createLockable()