Im using locking object in my application with multiple threads.
How i can check how many times other threads tried to work on locked object, or how much time i wasted on trying to update locked object?
My code is based on best answer here:
Mutliple threads updating array
Edit: code copied over:
float[] bestResult;
object sync = new Object();
lock (sync)
{
if (bestResult[0] > calculatedData[0]) {
bestResult = calculatedData;
}
}
The
System.Diagnostics.Stopwatchclass may help you here: