I have a large Java project that I am trying to optimize. I didn't write the code so I was using JDB and eclipse(remote debugging) to step through the code and understand it. I was wondering if there is a way to get the execution time as well when I step into/step over/step return in a method. So that I can only focus on those methods that are taking a lot of time to execute.
You can use "Visual VM" for that.
To getting started with VisualVM,
https://docs.oracle.com/javase/6/docs/technotes/guides/visualvm/intro.html
IDE support including Eclipse,
https://visualvm.github.io/idesupport.html
https://blog.idrsolutions.com/2013/05/setting-up-visualvm-in-under-5-minutes/
VisualVM Eclipse Launcher - Java Profiling Tutorial
Sample Demo