Java problem diagnosis tool–Greys-Anatomy

Introduce a very useful Java process monitoring tool, which can print out the average time and maximum time consumption of each method in the Java class, which is very helpful for troubleshooting delays in Java programs. The name of this tool is: Greys-Anatomy.
Greys positioning is a professional JVM business problem location tool. Since it is a JVM, most of the things we face are Java programmers. I hope to share all the skills and ideas I have when writing software, so that more Java programmers can participate in or benefit from development.

Main characteristics
View class and method information that has been loaded by the JVM

1, method execution monitoring

      Call volume, success failure rate, response time

2, the method performs data operations

      Input parameters, return value, exception information record and view; support action playback

3, performance overhead rendering

       Tracking method call trajectories in a specified path, taking time

View method call stack

Download and install

After the installation is complete, you can write a shell script, similar to the following (, assuming the java program is in the tomcat container):

Pid=$(ps -ef | grep -i tomcat-8.5-1 | grep -v 'grep'| awk '{print $2}')
/data/greys/ $pid@|tee -a /data/gresy/gresy.log

Execution script
> sh
The following interface appears

Then execute the monitor -c 5* * command to print the monitoring information every 5 minutes, as follows:

By printing the information, you can find out which method takes the longest time to execute.