Exploring Memory Analysis Views > Exploring the Instances View >  Filtering Data in the Instances View  

Filtering Data in the Instances View

There are two ways to filter the data in Instances view:

• You can use the text field above the table to filter by class, which narrows what is displayed in the view, but does not affect the underlying data set.

• You can also use the Set Filters dialog to set one or more filters by class. Using this method narrows or expands the underlying data set.

To filter the Instances view by class:

1 Type a pattern or comma-separated list of patterns in the Filter Classes text box.

2 Press Enter to apply the filter.

The table refreshes, listing only the classes that meet the criteria you entered. The number of classes/total classes is displayed beside the text field. Note that the chart is not affected.

Note The filters you enter in this field are saved and can be used later by clicking the down arrow and choosing them from the drop-down list.

To filter the Instances view using the Set Filters dialog:

1 Click the filter icon in the toolbar.

The Set Filters dialog opens.

2 Add filters to the New Filters list in one or more of the following ways:

• Click a line in the list to highlight it and type a pattern.

• Click in a line in the list to highlight it, then click the browse button to navigate to a class or method, and double-click it.

• Click Add Current Filters to add the filters that are currently in effect in the Instances view.

3 If you want to change the action for a filter, click in the Action column and choose the Include or Exclude.

4 Click OK when you have finished adding filters.

The view refreshes and displays only the instances that meet the filter criteria you have set. The bar chart is redrawn to reflect the matched instances.

Syntax for Instance Filters

Filters are case-sensitive and blanks are not allowed. You can use an asterisk (*) as a wild card; it matches any character, including the package separator. If you specify the code in a shorthand or partial form, JProbe automatically changes it to canonical form. The change may not be exactly what you desire, so be sure to verify it. JProbe does not check to see whether the filter actually matches anything in your code. For example, if you make a typing error in your package name, nothing in your code will match the filter and so the filter is not applied.

The following table contains common syntax and describes how JProbe interprets it:

 

If you type this:

Canonical form is this:

And filters are applied to:

*
*.*.*()

All methods in all classes in all packages (including the unnamed package)

.*
.*.*()

All methods in all classes in the unnamed package only

C
*.C.*()

All methods in classes named C in any package

.C
.C.*()

All methods in the class named C in the unnamed package only

M()
*.*.M()

Method M in all classes in all packages

P.String*
P.String*.*()

All methods in any class in the package P whose name starts with String and all methods in any class in a package or subpackage of P.String* (matches both P.StringArt.draw() and P.Stringent.Check.English.
spelling()
)

P.*.C.do*()

no change

Any method whose name starts with do in any class named C in any subpackage of P, except P directly (matches P.SubPkg.C.doGet(), but does not match P.C.doNotMatch())

Pre*
*.Pre*.*()

All methods in all classes starting with Pre in any package, as well as any class in a subpackage whose name starts with Pre (matches both Pkg.Prepare.m() and Pkg.Pretend.C.m())

s*y
*.s*y.*()

All methods in classes whose name ends with y and either starts with s or belongs to a subpackage that starts with s (matches both java.rmi.server.RMISocketFactory,com.quest.say, and java.security.cert.X509CRLEntry)

foo.bar
foo.bar.*()

All methods in the class bar in package foo. This is likely not what you wanted. See the next example.

foo.bar.*
foo.bar.*.*()

All methods in all classes in foo.bar or any of its subpackages

foo.bar.
String.t*e()

no change

Methods whose names start with t and end in e in foo.bar.String (matches both toUpperCase() and toLowerCase())