如何分析哪种方法在java,eclipse,junit中消耗更多时间? [英] How do I analyze which method consumed more time in java,eclipse,junit?

查看:107
本文介绍了如何分析哪种方法在java,eclipse,junit中消耗更多时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一些职业java程序员来说,这可能是一个愚蠢的问题,但我现在很生气,所以我仍然在问。请指导我一个正确的方向。

This may be a silly question for some pro java coders but I am going mad right now, so I am still asking. Please guide me in right direction someone.

如何分析哪个方法/ partOfMethod在我的java程序中消耗更多时间?

How do I analyze which method/partOfMethod is consuming more time in my java program?

(我正在使用Eclipse和Junit)

(I am using Eclipse and Junit)

推荐答案

使用jvisualvm 。它现在与JDK捆绑在一起,但也存在独立版本,这是更新的。
通常,当你启动它时,你可以选择要连接的运行java进程(这可能是我们的运行单元测试)。您可以指定需要跟踪的合格类名称过滤器。通常,会发生一些类检测,您将能够跟踪分配给每种方法的处理时间(累计时间)。

Use jvisualvm. It is bundled in with the JDK nowadays, but a standalone version exists as well, which is more up to date. Typically, when you start it you can pick which running java process to connect to (this may well be our running unit test). You can specify which qualified class name filters you need to track. Normally, some class instrumentation will ensue, and you will be able to track the processing time allocated to each method (cumulative time as well).

这篇关于如何分析哪种方法在java,eclipse,junit中消耗更多时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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