How to find how many times a method is used?
A general answer to this question would be something like this:
public class MyClass {
static int count = 0;
public void myMethod() {
count++;
}
}
Using static int would seem a perfect solution. Static will share the instance variable count among all instances of MyClass.
However, problem occurs in a multi threaded environment, as the count incrementation is not synchronised.