Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use idea to view the calling process of a method in java

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces how to use idea to view the calling process of the method in java, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.

As shown in the figure, when running main functions or unit tests in idea, you have the following options

Generally speaking, we are the first or second to run the point.

Run StringUtils.main (): run directly

Debug StringUtils.main (): runs as debug and can break points

Run StringUtils.main with Coverage runs with run coverage report

With this run, you can see our code coverage report:

New add-on operation of idea 2019.2

In these three, we can see information such as runtime, method calls, and so on.

Run StringUtils.main () with Allocations Profiler: when you run with this, you can see the thread information and the method call stack information in the thread.

Run StringUtils.main () with CPU profiler: running with this, you can see some ways for the virtual machine to interact with cpu, comparing the underlying layer

Run StringUtils.main with Java Flight Recorder: with this run, you can see some information about the runtime system recorded by the java flight recorder

Through the call of these additional methods, we can see some internal information of the system, which can learn the source code and point the path for us.

Run StringUtils.main () with Allocations Profiler

For example, the following figure shows a list of methods called when running spring, in which you can clearly see the context loading of springboot, initialization and filling of bean, which can help you learn the major components of spring, as well as the source code.

Run StringUtils.main () with CPU profiler

When you run through CPU profiler, you can see something at a lower level, and there are also some outer calling methods, and more methods such as CSync + underlying method calls, invoke and so on.

Run StringUtils.main with Java Flight Recorder

On the first call, you need to configure the jvm parameter:

Configure jvm parameters in configuration in the upper right corner of idea

Click Run StringUtils.main with Java Flight Recorder, as shown in the following figure, you can not only see the Flame Graph, Call Tree, and MethodList in Allocations Profiler, but also add an Event. You can see some events when JVM is running, such as GC, Thread, similar to the black box on the plane. You can see an internal parameter, status, which is of great help to jvm tuning.

Finally, a few words.

Idea still has many powerful functions waiting for you to explore, such as directly connecting to the database, directly connecting to redis, and directly connecting to the remote server through ssh. There are many powerful functions that you can share with the knife: best396975802

On how to use idea in java to view the method call process is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report