Title: Execution time between two lines or a function in eclipse
Tags: java;eclipse;performance;ide
Question: In eclipse, I couldn't find how to get the IDE to display the amount of time it took for a program to execute. I've checked help and googled and I'm not finding anything
I don't want to write startTime,endTime code around each &amp; every line.
Is there any way we can do it in eclipse or through eclipse plugin without writing code.
Comment: You can't do it using your IDE solely.You can connect to Visual VM and track the processing time for each method.

Comment: @NamingException,Please go through http://stackoverflow.com/questions/16441274/how-to-use-visualvm-to-get-the-time-each-function-costs

Comment: subsctractiing end time from begin time... System.nanoTime() or System.currentTimeMillis()...

Comment: Use JVisualVM or similar to profile your app.

Comment: @ΦXocę웃Пepeúpaツ  This is what I have written in my question,If you read it carefully.
I don't want to write code every time whenever I suspect that this line/function is taking time in execution.

Comment: @AnkitTripathi,I have connected my tomcat to Visual VM but couldn't figure out how to find processing time for each method ??
Any idea about this ?


Here is another answer: long startTime = System.nanoTime();
// ... the code being measured ...
long estimatedTime = System.nanoTime() - startTime;
Props to:
How do I measure time elapsed in Java?

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 6, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:09/29/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><eclipse><performance><ide>', 'Title': 'Execution time between two lines or a function in eclipse', 'ViewCount': 2175, 'id': 39763353, 'user_AboutMe': '', 'user_AccountId': 2418810.0, 'user_DisplayName': 'NameNotFoundException', 'user_Reputation': 866.0, 'user_Views': 218.0, 'user_id': 2112296.0}}