在IntelliJ IDEA中检查运行时间 [英] Checking Run time in IntelliJ IDEA
问题描述
如何查看在InteliJ中运行代码需要花费多少时间?
How can I see how much time it took for the code to run in InteliJ?
推荐答案
我认为您无法使用Intellij,您必须使用 Yourkit 这样的分析器来分析代码或使用一些 System.currentTimeInMillis()使用原始基准测试.另外,您可以使用 Apache Commons StopWatch 进行一些基准测试:
I don't think you can with Intellij, you either have to use a profiler like Yourkit to profile the code or use some primitive benchmarks using System.currentTimeInMillis(). Alternatively you can use Apache Commons StopWatch to do some benchmarking:
StopWatch stopwatch = new StopWatch();
stopwatch.start();
... some code...
stopwatch.stop();
long timeTaken = stopWatch.getTime()
Intellij有一个可用VisualVM进行性能分析的插件,您可以将其安装为另一种选择.
There is a plugin available for Intellij that uses VisualVM to do profiling, you could install this as another alternative.
http://plugins.intellij.net/plugin/?id=3749
这篇关于在IntelliJ IDEA中检查运行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!