Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

VisualVM uses Java to perform it's work. This means you will see some artefacts which relate to the RMI calls it makes. You can ignore them.

I use YourKit which doesn't do this, but it's not free ;)

VisualVM will track all methods being called by the java program it's monitoring, so either your program or one of its libraries is calling those methods. VisualVM is also connecting to it so there might be some small artifacts.

As for searching, probably the easiest way is to filter by your own packages. There is a space at the bottom where you can enter those so you can see which of your own methods is really taking time. Also you should pay attention to which thread you are in, usually you will want to look at the whatever is your "main" thread. The other threads are interesting but won't always give you the best idea of how your program behaves.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top