Filtering
jMechanic filtering support can be used to remove extraneous
information from the CPU Snapshots and Heap Allocation Views. By
removing the extraneous information, you will be more able to find the
code that is contributing to the performance of your application.
Select the Filter action on the CPU Snapshots or Heap Allocations view
to select the filtering for the current snapshot in the view.
(Click to enlarge)
Filter Selection Dialog Items
Enable Filtering
Use the Enable Filtering checkbox to enable or disable the filtering.
Add Type...
The Add Type... button allows a specific type to be selected for
filtering.
Add Package...
The Add Package... button allows a package prefix to be selected for
filtering.
Remove Components
The Remove Components button removes all selected filter components
from the current filter.
Filter Processing
At the lowest level, filters are applied to individual stack frames in
the captured data. If all stack frames in a stack trace are
excluded, then the stack trace is excluded along with the data
attributed to that stack trace. The filter components are applied
in two passes:
- The type exclusions are applied in sorted order using an equality
test for the fully-qualified class name in the stack frame.
- The package prefixes are applied in sorted order using a "starts
with" test for the fully-qualified class name in the stack frame.
This implies a few things about choosing filter component values:
- Choose specific types when it make sense, as these will be
applied first.
- Choose the most inclusive packages prefix possible to avoid extra
exclusion checks. For instance, choose "java*" versus "java.lang,
javax*" when possible.
Notes:
- At this time, filters are transient.
Filters are only in effect on a per-snapshot basis. When a new
snapshot is taken, the current filter settings will be lost.
Support for more persistent filters will be added in an upcoming
release of jMechanic.