Telerik blogs
In a profiling session lasting only a few minutes, the profiled application may perform millions of operations. The following image shows that in less than two minutes, the program called three property assessors over 10 million times each.

JustTrace filtering snapshot data image

You may have noticed something odd about these methods. Each belongs to types in the System namespace hierarchy. This is not application code; it belongs to the .NET Framework.

Both .NET Framework and third party types may be useful when researching memory and performance problems. On the other hand, they may make it more difficult to obtain relevant data. This is especially true when proactively analyzing an application to ensure its quality during the development cycle. JustTrace provides filtering options to fulfill both needs.

Filter .NET Framework Internals

JustTrace offers an important filter when beginning a new performance profiling session with the Tracing Profiler: Filter .NET Framework internals. Enabling this filter reduces the impact of the profiler on the application by a significant amount as JustTrace excludes internal calls within the .NET framework.

JustTrace filtering snapshot data image

Turn this on for most scenarios. Turn the filter off when searching for issues inside the .NET Framework itself.

Assemblies View

Clicking the ASSEMBLIES item in the left panel displays a view containing a list of assemblies loaded by the profiled process. A checked box indicates an application-specific assembly. An unchecked box indicates third party or .NET Framework assemblies.

Assemblies view

This view is available in both performance and memory snapshots.

Just My Code  

After selecting assemblies belonging to the MY CODE category, use the JUST MY CODE button to toggle between displaying methods belonging to the application and every method.

Just My Code image

In tree views, such as the HOT SPOTS, this toggle operates on the selected node rather than the entire tree. It has four states.

Definitions for simplification:

  • user call - a method in an assembly marked “My Code.”
  • external call - a method in an assembly not marked “My Code.”
  • on - button is selected
  • off - button is not selected
  • immediate children - nodes directly attached to the selected node according to the visible tree
Button states:

  • Enabled and on – the selected node is only displaying immediate user call children but has immediate external call children that are not displayed.
  • Enabled and off – the selected node is displaying immediate external call children and user call children are attached or exist deeper in the tree.
  • Disabled and on – the selected node only has immediate user call children.
  • Disabled and off – the selected node only has immediate external call children and no other user call children are present
Just My Code image

Clicking the JUST MY CODE button in the enabled and on state displays external calls in each descending tree path, stopping on the next user call.

Minor Methods  

The MINOR METHODS toggle on the ALL METHODS view makes the list display all methods when highlighted. When it is not, the list hides methods that consume only a small amount of execution time.

minor methods image
 
Since minor methods are unlikely to affect performance, hide them to focus on better optimization targets.

Group Minor Calls  

GROUP MINOR CALLS is a multi-state toggle, similar to the JUST MY CODE button, found on views in the CALL TREES category. When highlighted, this toggle makes the selected node hide immediate children with minute execution time. Unlike the JUST MY CODE toggle, the node displays a grouping child node with aggregate details on the minor calls.

This button has only one state for disabled, indicating that the selected node lacks immediate minor call children.
 
Group Minor Calls image

Just My Types  

The BY TYPE and INCOMING REFERENCES BY TYPE views for memory snapshots contain a corollary to the JUST MY CODE toggle: JUST MY TYPES. This button toggles between all types and types belonging to the assemblies selected in the ASSEMBLIES view.

 Just My Types  image 

Generations

The Common Language Runtime manages object lifetimes, and instances are marked in various stages of garbage collection. The BY TYPE view includes generational filtering, only displaying instances in the selected stage of collection. The options are All Generations, Generation 0, Generation 1, Generation 2, and the Large Object Heap.

Select this filter using the dropdown as shown in the screenshot.

Generations image
 

Summary

Profiling .NET applications for performance or memory management issues generates a vast amount of data. Filtering this data makes it easier to isolate issues and ultimately create a solution. This article described various filters you can use when analyzing JustTrace snapshots.

Would you like to see other filters included in JustTrace? Please visit the JustTrace Feedback Portal to vote on other’s suggestions and let us know what you would like in future editions of JustTrace.
 

Chris understands that ‘external calls’ typically refers to interop or non-.NET operations, but he thought ‘third-party calls’ sounded odd when frequently used.


About the Author

Chris Eargle

is a Microsoft C# MVP with over a decade of experience designing and developing enterprise applications, and he runs the local .NET User Group: the Columbia Enterprise Developers Guild. He is a frequent guest of conferences and community events promoting best practices and new technologies. Chris is a native Carolinian; his family settled the Dutch Form region of South Carolina in 1752. He currently resides in Columbia with his wife, Binyue, his dog, Laika, and his three cats: Meeko, Tigger, and Sookie. Amazingly, they all get along... except for Meeko, who is by no means meek.

Comments

Comments are disabled in preview mode.