James Van Boxtel
James Van Boxtel

Reputation: 2405

Limiting Profiling in Visual VM

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.

Upvotes: 3

Views: 3466

Answers (3)

Fabio Bonfante
Fabio Bonfante

Reputation: 5188

Actually there's an opened bug about that:

https://java.net/jira/browse/VISUALVM-546

I totally agree with the submitter (and with your disappointing about the "strange" behavior of VisualVM). Even with "Profile new Runnables" checked the filter must be honored in my opinion.

Profiling it's an important task to do especially with large project typically deployed on application-server where it's the common-way (and the right-way) have threads for background tasks and to serve user requests.

I invite everybody to vote for give attention from the VisualVM developers.

Upvotes: 2

dirtyvagabond
dirtyvagabond

Reputation: 1901

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.)

Upvotes: 2

gustafc
gustafc

Reputation: 28865

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

Upvotes: 0

Related Questions