jvm method invocation history trace
I have a question. Let's say I am running some java core application and I don't really know much about it. The service gets requests and sends back responses. What I want to know is which classes (and methods) are being currently called. Is it possible to put some kind of a time frame and get all java method calls for specific packages (like com.company.xxxx)? Can I use JConsole or any tools available for it?
I appreciate your response
Thank开发者_Go百科s
You can issue a thread dump using JConsole.
- add to
java
command and run
java -classpath ... -Xdebug -Djava.complier=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000 ... Main
- open
jdb
$ jdb -attach localhost:5000
- in
jdb
...
Initializing jdb ...
> threads
Group system:
(java.lang.Thread)0x10bd ...
0x10bd
is the thread id
trace go methods 0x10bd
you will see a line for each enter & exit method
精彩评论