Mutex Probes

Mutexes enforce mutual exclusion to critical sections. When a thread attempts to acquire a mutex held by another thread using mutex_lock(3C) or pthread_mutex_lock(3C), it will determine if the owning thread is running on a different CPU. If it is, the acquiring thread will spin for a short while waiting for the mutex to become available. If the owner is not executing on another CPU, the acquiring thread will block.

The four plockstat probes pertaining to mutexes are listed in Table 31–1. For each probe, arg0 contains a pointer to the mutex_t or pthread_mutex_t structure (these are identical types) that represents the mutex.

Table 31.1. Mutex Probes

mutex-acquire

Hold event probe that fires immediately after a mutex is acquired. arg1 contains a boolean value that indicates whether the acquisition was recursive on a recursive mutex. arg2 indicates the number of iterations that the acquiring thread spent spinning on this mutex. arg2 will be non-zero only if the mutex-spin probe fired on this mutex acquisition.

mutex-block

Contention event probe that fires before a thread blocks on a held mutex. Both mutex-block and mutex-spin might fire for a single lock acquisition.

mutex-spin

Contention event probe that fires before a thread begins spinning on a held mutex. Both mutex-block and mutex-spin might fire for a single lock acquisition.

mutex-release

Hold event probe that fires immediately after an mutex is released. arg1 contains a boolean value that indicates whether the event corresponds to a recursive release on a recursive mutex.

mutex-error

Error event probe that fires when an error is encountered on a mutex operation. arg1 is the errno value for the error encountered.