开发者

jvm method invocation history trace

开发者 https://www.devze.com 2023-01-25 15:40 出处:网络
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 (

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.


  1. add to java command and run

java -classpath ... -Xdebug -Djava.complier=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000 ... Main

  1. open jdb
$ jdb -attach localhost:5000
  1. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号