如何查看在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()commons.apache/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/time/StopWatch.html
Intellij有一个可用VisualVM进行性能分析的插件,您可以将其安装为另一种选择.
There is a plugin available for Intellij that uses VisualVM to do profiling, you could install this as another alternative.
plugins.intellij/plugin/?id=3749
更多推荐
在IntelliJ IDEA中检查运行时间
发布评论