本文介绍了Eclipse获取程序执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
OS:WinXP
在类似UNIX的环境中,我们可以通过 $ time ./my_program。我想知道我们可以在Eclipse中获取执行时间信息吗?没有分析器,是否可以执行此操作?谢谢。
Under UNIX-like environment, we can get execution time by
$time ./my_program
. I wonder we can get execution time info in Eclipse? Is it possible to do this without a profiler? Thanks.
推荐答案
看来TPTP Eclipse插件具有此功能:
It looks like the TPTP Eclipse plugin has this feature: http://www.eclipse.org/tptp/
您可以得到一个近似值通过时间戳的不同:
You could get an approximation of it by the difference of timestamps:
public static void main(String[] args) throws IOException {
long start = System.currentTimeMillis();;
new MyApplication();
long end = System.currentTimeMillis();;
System.out.println((end - start) + " ms");
}
这将以毫秒为单位打印运行时间。
This will print the runtime in ms.
这篇关于Eclipse获取程序执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!