views:

450

answers:

2

I am trying out the VisualVM program that comes with the new JDKs. I am doing profiling on it and trying to profile CPU on only methods in a particular package.

I put the following in the "Profile Only Classes:"

jig.*

Where jig is the package I want to instrument. Unfortunately I get back results on other methods that are not in that package or any subpackages.

A: 

You can enter a filtering criterion in the text field at the bottom of the "Profiling Results" list, that should do the trick.

gustafc
+1  A: 

The only way I can reproduce your problem is if I leave the "Profile new Runnables" box checked. When I leave that checked, the profiler picks up code started as new threads, even if that code does not meet the filtering criteria. I guess this is unclear functionality.

You should make sure you uncheck that box before you do your profiling activity. Just be aware that with it unchecked, that probably means you won't see profile information of any of your own code that happens to be started as a separate Thread. (But I figure there's a good chance you're not doing that, so you have nothing to be concerned about.)

dirtyvagabond