In neolib (C++ support library used by neoGFX) you can now profile
spinlock mutex contention. #cpp #coding #gamedev
static struct debug_mutexes : neolib::i_mutex_profiler_observer
{
void mutex_contended(neolib::i_lockable& aMutex, const std::chrono::microseconds& aContendedFor,
neolib::mutex_lock_info const* aPreviousLocks, std::size_t aPreviousLocksCount) noexcept final
{
}
} sDebugMutexes;
service<neolib::i_mutex_profiler>().enable(std::chrono::microseconds{ 100 }, 10u, true);
service<neolib::i_mutex_profiler>().subscribe(sDebugMutexes);
On 12/21/2025 1:36 PM, Mr Flibble wrote:service<neolib::i_mutex_profiler>().subscribe(sDebugMutexes);
In neolib (C++ support library used by neoGFX) you can now profile
spinlock mutex contention. #cpp #coding #gamedev
static struct debug_mutexes :
neolib::i_mutex_profiler_observer {
void mutex_contended(neolib::i_lockable& aMutex, const
std::chrono::microseconds& aContendedFor,
neolib::mutex_lock_info const* aPreviousLocks,
std::size_t aPreviousLocksCount) noexcept final
{
}
} sDebugMutexes;
service<neolib::i_mutex_profiler>().enable(std::chrono::microseconds{
100 },
10u, true);
spinlock mutex contention. Humm. Are you using spinlock, mutex or
adaptive mutex?
On Mon, 22 Dec 2025 13:37:18 -0800, Chris M. Thomasson wrote:
On 12/21/2025 1:36 PM, Mr Flibble wrote:service<neolib::i_mutex_profiler>().subscribe(sDebugMutexes);
In neolib (C++ support library used by neoGFX) you can now profile
spinlock mutex contention. #cpp #coding #gamedev
static struct debug_mutexes :
neolib::i_mutex_profiler_observer {
void mutex_contended(neolib::i_lockable& aMutex, const >>> std::chrono::microseconds& aContendedFor,
neolib::mutex_lock_info const* aPreviousLocks,
std::size_t aPreviousLocksCount) noexcept final
{
}
} sDebugMutexes;
service<neolib::i_mutex_profiler>().enable(std::chrono::microseconds{
100 },
10u, true);
spinlock mutex contention. Humm. Are you using spinlock, mutex or
adaptive mutex?
spinlock (non-pure).
On 12/22/2025 1:49 PM, Mr Flibble wrote:
On Mon, 22 Dec 2025 13:37:18 -0800, Chris M. Thomasson wrote:
On 12/21/2025 1:36 PM, Mr Flibble wrote:service<neolib::i_mutex_profiler>().subscribe(sDebugMutexes);
In neolib (C++ support library used by neoGFX) you can now profile
spinlock mutex contention. #cpp #coding #gamedev
static struct debug_mutexes :
neolib::i_mutex_profiler_observer {
void mutex_contended(neolib::i_lockable& aMutex,
const
std::chrono::microseconds& aContendedFor,
neolib::mutex_lock_info const* aPreviousLocks,
std::size_t aPreviousLocksCount) noexcept final
{
}
} sDebugMutexes;
service<neolib::i_mutex_profiler>().enable(std::chrono::microseconds{
100 },
10u, true);
spinlock mutex contention. Humm. Are you using spinlock, mutex or
adaptive mutex?
spinlock (non-pure).
Well, I guess I can call an adaptive mutex a non-pure spinlock in a
strange sense. :^)
They spin several times before they hit the slow path, aka, waiting in
the kernel.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,090 |
| Nodes: | 10 (1 / 9) |
| Uptime: | 59:51:27 |
| Calls: | 13,948 |
| Calls today: | 1 |
| Files: | 187,035 |
| D/L today: |
2,695 files (773M bytes) |
| Messages: | 2,461,296 |