Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding CPU time in visualvm profiler

I have started to use visualvm for profiling my application which I launch in Eclipse. Then I launch visualvm which initially gives believable results.

enter image description here

After some time two processes appear in the monitor which consume huge amounts of time.

enter image description here

I have not deliberately invoked these. After a time they disappear. Are they an artefact of the profiling process and do I need to worry?

Very few of my routines appear in the profile, mainly the libraries they call. Is there a way of showing which routines call the most heavily used ones?

like image 658
peter.murray.rust Avatar asked Jun 11 '13 16:06

peter.murray.rust


People also ask

What is self time VisualVM?

Self Time: total time spent invoking this method. If a method was called twice, the self-time will be the sum of the time spent in each call excluding internal method calls. Self Time (CPU): the same as Self Time except that only CPU execution time is considered, omitting I/O operations.

What is profiler in VisualVM?

Java VisualVM enables you to take profiler snapshots to capture the results of a profiling session. A profiler snapshot captures the results at the moment the snapshot is taken. To take a snapshot, click the Take Snapshot of Collected Results button in the toolbar while a profiling session is in progress.

How use VisualVM performance testing?

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.

How do I use J profiler?

If you need to collect and display analytical data of a remote JVM in real time, perform the following steps: Install JProfiler UI locally. Install JProfiler agent on the remote host machine, and load it to the target JVM. Connect JProfiler UI to the agent.


1 Answers

It is better to start with CPU sampling, if you don't know which part of the code is slow. Once you know better (based on the sampling results) what is going on, you can profile just part of your application, which is slow. You need to set profiling roots and instrumentation filter and don't forget to take the snapshot of collected results. See Profiling With VisualVM, Part 1 and Profiling With VisualVM, Part 2 to get more information about profiling and how to set profiling roots and instrumentation filter.

like image 185
Tomas Hurka Avatar answered Sep 21 '22 05:09

Tomas Hurka