Synchronized/Threads - Checking for Bottlenecks
Posted on 2004-09-07
We have an application that uses multiple threads to perform a calculation. When any method has found a possible "Solution" it writes to a database.
We want to track the performance of the application and the number of calculations that it has performed, therefore, we have implemented a single class which has Synchronized methods to count the number of calculations performed.
If a Thread is currently using the "Synchronized Counter Method" and another method tries to access it - it waits until the Thread has finished. What I would like to find out is how many "waits" are occuring. I.e. is the counting aspect slowing down the application by causing a bottle neck.
With approximately 680 calculations per minute. This is a concern.
Is there anyway determine if these "waits" are occuring? Due to the nature of the program it is not possible to switch off the counting and switch it back on again and compare the executing time.