查找Java程序的实际运行时调用树 [英] Finding the actual runtime call tree of a Java Program

查看:712
本文介绍了查找Java程序的实际运行时调用树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个大程序,其中包含数百种方法。并根据输入的性质,程序流程正在变化。



想想我要更改原始流程。找到调用层次结构/引用并了解流程是很麻烦的。



我在Eclipse中有什么解决方案吗?还是插件?例如,我只需要按时间顺序的方法名称日志。然后我不需要担心与我的给定输入无关的方法



更新:在eclipse中使用调试模式或添加打印消息是不可行的。该程序是sooooo大。 :)

解决方案

您可以使用 AspectJ 记录名为的所有方法的名称,而不用更改原始程序。



请参阅 跟踪 例如

  aspect SimpleTracing {
pointcut tracedCall():
call(void FigureElement。 draw(GraphicsContext));

before():tracedCall(){
System.out.println(Entering:+ thisJoinPoint);
}
}


Suppose I have a big program that consists of hundreds of methods in it. And according to the nature of input the program flow is getting changed.

Think I want to make a change to the original flow. And it is big hassle to find call hierarchy/ references and understand the flow.

Do I have any solution for this within Eclipse? Or a plugin? As an example, I just need a Log of method names that is in order of time. Then I don't need to worry about the methods that are not relevant with my "given input"

Update : Using debug mode in eclipse or adding print messages are not feasible. The program is sooooo big. :)

解决方案

You could use AspectJ to log the name of all methods called without changing your original program.

See tracing for instance.

aspect SimpleTracing {
    pointcut tracedCall():
        call(void FigureElement.draw(GraphicsContext));

    before(): tracedCall() {
        System.out.println("Entering: " + thisJoinPoint);
    }
}

这篇关于查找Java程序的实际运行时调用树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆