1. Home
  2. Docs
  3. Llamachant Framework Modules
  4. Additional Modules
  5. Performance Diagnostic Module

Performance Diagnostic Module

This module helps you track down problematic code in your XAF solution with the use of the PerformanceDiagnosticUtil. This Module will display how many times a tracked section of code is called, how long the application spent on those calls in total, and the average of time spent by the application per code call. 

Getting Started

  1.  Install the LlamachantFramework.Performance.Module from NuGet into your solution.
  2.  Include  LlamachantFramework.Performance.Module.LlamachantFrameworkPerformanceModule in the RequiredModuleTypes collection of your .Module project
  3.  Enable the module to work only in debug mode by setting Instance.Enabled = Debugger.IsAttached
  4.  Run your application and click Measure BO Performance then set the type to a business object to inspect. Alter any other settings or add in filters as needed then click OK to view the results.
  5.  Click Show Performance Results to view results at any time while testing
  6. Click Reset Performance Results to remove all calculated counters

Register and Enable the Module

					public YourApplication() {
            LlamachantFramework.Performance.Module.Utils.PerformanceDiagnosticUtil.Instance.Enabled = Debugger.IsAttached; //This line is critical

Diagnose Custom Code

It is recommended to use a try finally block with the start and stop timers to track a section of the code for best results.

This section tracking will work for controllers or any other part of your application. To record performance metrics, run the actions in the application that use the tracked code then click on Show Performance Results.

    //lines of code you want to inspect go here           

Call Tracing

The Performance Results window displays a detail view on the side that records a call trace for tracked code. Here you can find which methods call the code segment and in what order the code segment is called.

Was this article helpful to you? Yes No

How can we help?