Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Total method time in Java VisualVM

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?

like image 222
kpozin Avatar asked Dec 12 '09 02:12

kpozin


People also ask

What is self time VisualVM?

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.

Does VisualVM work with Java 11?

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.

How do I monitor VisualVM?

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.

Is Java VisualVM free?

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.


1 Answers

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)

like image 146
Joseph Cottam Avatar answered Sep 22 '22 03:09

Joseph Cottam