You need to use profiling tools like Java hprof . This is a good introduction to profiling. Although not very effective, this is a good start. There are many other useful tools for profiling. Just go to Google.
For hprof processor usage sampling profile modes (cpu = samples)
eg javac -J-agentlib:hprof=cpu=samples Hello.java
and CPU usage time (cpu = times)
eg javac -J-agentlib:hprof=cpu=times Hello.java
sounds the way you need it. They can tell you what is called and how often. What they will not tell you is the state of the variables. This is what is used for debugging, since registration is not an option.
source share