Is there a way to get textual output of every method invoked by the JVM at runtime?
-
1There's probably a better way of getting what you want. Are you trying to debug something? – Matt Ball Nov 25 '13 at 20:10
-
Tracing the call stack of runtime code with a lot of reflection (hadoop). – jayunit100 Nov 25 '13 at 20:13
-
Have you checked this question: http://stackoverflow.com/questions/706292/java-determining-current-call-stack-for-diagnostic-purposes? – Katona Nov 25 '13 at 20:19
-
Is there a specific issue you're trying to debug? – Matt Ball Nov 25 '13 at 20:21
-
specifically, i want to see how many times every method in a distributed system is being called. I want to see which operations in my classes are most used. – jayunit100 Dec 10 '13 at 23:02
4 Answers
If you are using Eclipse you can right click the method and choose "Open call hierarchy"
I am not very sure if you are looking for ASM, it is used for analyzing the bytecodes
ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex transformations and code analysis tools.
ASM offer similar functionality as other bytecode frameworks, but it is focused on simplicity of use and performance. Because it was designed and implemented to be as small and as fast as possible, it makes it very attractive for using in dynamic systems*.

- 168,305
- 31
- 280
- 331
-
the eclipse way is only for statically defined hierarchies. ASM possibly could be used. – jayunit100 Dec 10 '13 at 23:01
You should use Java profiler tool. There are two well-known profilers - YourKit Java Profiler and JProfiler.
I prefer first one, but you can try both and make your choice.

- 1,949
- 18
- 26