Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking Run time in IntelliJ IDEA

How can I see how much time it took for the code to run in InteliJ?

like image 731
Eran Avatar asked Jul 31 '09 00:07

Eran


People also ask

How do I get the run option in IntelliJ?

From the main menu, select Run | Edit Configurations. Alternatively, press Alt+Shift+F10 , then 0 . on the toolbar or press Alt+Insert . The list shows the run/debug configuration templates.

What is the Run command in IntelliJ?

Run a class with a main() method: Shift+F10. You can run applications right from IntelliJ IDEA if you have an SDK set up for your project/module.

What is JetBrains runtime?

JetBrains Runtime is a fork of OpenJDK available for Windows, Mac OS X, and Linux. It includes a number of enhancements in font rendering, HiDPI support, windowing/focus subsystems, performance improvements and bugfixes.


1 Answers

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()

https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/time/StopWatch.html

EDIT: 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

like image 129
Jon Avatar answered Oct 11 '22 02:10

Jon