在IntelliJ IDEA中检查运行时间

编程入门 行业动态 更新时间:2024-10-26 14:27:43
本文介绍了在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()

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中检查运行时间

本文发布于:2023-11-30 21:38:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651549.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间   IntelliJ   IDEA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!