In Java VisualVM, is there any way to display total method time, rather than "self time"? (The latter is not particularly useful, since it doesn't tell you anything about how much time methods actually take to run.)
If not, is there any standalone free Java profiler that does calculate total method time?
Self Time is a wall-clock time spent in the method itself (includes time waiting/sleeping). Self Time (CPU) is a time processor time, so it does NOT include time spent waiting, sleeping, etc. Both columns do NOT include time spent in methods invoked from that method.
Use VisualVM bundled with GraalVMGraalVM contains a fully compliant Java SE 8, Java SE 11, and Java SE 17 JDK distribution based on Oracle JDK and OpenJDK. It features an innovative JIT compiler which may noticeably improve performance of Java applications, compared to the standard Oracle JDK or OpenJDK.
Under the Local node in the Applications window, right-click the application node and choose Open to open the application tab. Click the Profiler tab in the application tab. Click Memory or CPU in the Profiler tab. When you choose a profiling task, VisualVM displays the profiling data in the Profiler tab.
With features like thread analysis and head dump analysis, it is very handy in solving run-time problems. VisualVM is free, and you don't need to pay a separate cost to get this.
Looking at the trace data in a "snapshot" view allows you to see the total as well as the self time.
Press the "snapshot" button that appears about the table of results. This will create a new tab that contains a "Call Tree" view which breaks down the self vs. total time. The "combined" view also provides this information, but splits the screen space with a "Hot Spots" view that is similar to the standard profiling view.
Snapshots can be created from either standard "Profiler" or "Sampler" data. However, "Profiler" snapshots can only be created before the application is closed, while "Sampler" ones can be created at any time.
(The above information is based on VisualVM 1.3.1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With