Creating Custom Filter Sets

Creating Custom Filter Sets

You can apply filters when running profiling CPU usage in a Custom Profile or running the Analyze Performance profiling task. Applying a filter enables you to limit the classes that are instrumented, allowing you to include or exclude combinations of classes. Limiting the instrumented classes reduces the profiling overhead.

To apply filters to a task, you first create a filter set which contains the filters you specify. When creating a filter set, you specify which filters are used in the set. You also set the filter set to one of the following types:

  • Exclusive. When selected, classes meeting the criteria of the selected filters are excluded and not instrumented. Profiling results for these classes do not appear in the collected results.
  • Inclusive. When selected, only the classes meeting the criteria of the selected filters are included in the instrumentation. Profiling results are collected only for these classes.

You create and modify filter sets in the Customize Filter Sets dialog box. The Defined Filter Sets pane lists the existing filter sets. You can modify an existing filter set by selecting the filter set in the Defined Filters Sets list and then activating or deactivating filters in the Global Filters list. Profiler includes the Exclude Java Core Classes filter set.

The Customize Filter Set dialog box lists Global Filters that you can add to your custom filter sets. You can add and remove filters to the list of Global Filters by clicking the Edit Global Filters button in the Customize Filter Set dialog box. You can double-click a filter in the Global Filters list to open the Edit Global Filters dialog box.

To Create a New Custom Filter Set

  1. Open the Customize Filter Sets dialog box by doing either of the following:
    • Choose Analyze Performance in the Select Profiling Task dialog box and click Customize Filter
    • Choose Custom Profiling in the Select Profiling Task dialog box, select CPU profiling and click Customize in the Basic tab in the Options section.
  2. Click Add and enter a name for the new Filter Set. Filter set names must be unique.
  3. Specify the Filter Set Type: inclusive or exclusive.
  4. In the Global Filters list, activate the global filters you wish to be part of the filter set by selecting the checkbox for that filter. Place your cursor over the values to see all the patterns included in that filter.
  5. Click OK to save the new custom filter set.

Once created, you can apply your filter set by doing the following:

  • Choose Analyze Performance in the Select Profiling Tasks dialog box and choose a filter set from the Filter drop-down list.
  • Choose Run Custom Profiling in the Select Profiling Tasks dialog box and choose an existing or create a new custom CPU profiling task. Click the Basic tab in the Options section and choose a filter set from the Instrumentation Filter drop-down list.

Using a Filter Set

Using a filter set can help lower the profiling overhead and narrow down the results. For example, if you want to profile an application which consists of many different libraries but you do not know exactly where the problem is, you will most likely use an exclusive filter set, and exclude the core Java classes (the problem probably will not be there). By doing this you significantly reduce the profiling overhead, but you can still see the results for all application libraries.

If you are sure you know the problem is in a specific library/class, you can use an inclusive filter set, using a filter set to match those classes. Profiling overhead will then be minimal and you will see results only for the classes you are interested in.

Global Filters

The Customize Filter Sets dialog box includes a list of predefined filters that you can use when creating your filter sets. Each filter in the list represents groups of patterns that are typically related to one application. For example, org.netbeans is a pattern. A filter can contain more than one pattern. Patterns can be separated by a comma and/or space.

Filters are applied in a "starts with" manner. For example, if the filter contains org.netbeans, classes in the package org.netbeans.modules.classfile.Annotation would be matched by the filter.

Note: Using * in the pattern has no impact on filter behavior.

To modify or create global filters, click Edit Global Filters in the Customize Filter Sets. In the Edit Global Filters dialog box you can do the following:

  • Add a new filter. Click New to create a new row in the list and type the new name and values directly in the fields in the list. Filter names must be unique.
  • Edit a filter. Select a filter from the list and click Edit. Type directly in the fields in the list to edit the name or value.
  • Delete a filter. Select a filter from the list and click Delete.
  • Change the order of filters. Select a filter from the list and use the Move Up and Move Down buttons to change the list order.

See also

 

Project Features

About this Project

Profiler was started in November 2009, is owned by Tomas Hurka, and has 58 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close