I have been asked to measure the contention of locks a write process is causing. I was looking at the data of the lockstat for that write process.
My questions are below:
Is contention related to the number of times threads wait for the particular lock, as it is taken by another thread or the time for which threads have to wait for that lock to get freed?
Is it correct to calculate the contention as a measure of both:
- nsec (avg amount of time threads have to wait for the event to occur/lock to get freed) and
- cnt (number of times event occurred)
from profiling data collected from lockstat for a particular lock? i.e contention ~ nsec * cnt