Search Wiki:
Written By: Irinel Crivat, Program Manager
Microsoft, January 2008

Summary:

This article is a tour of a quick and reliable performance analysis profiler tool that assists in the development and debugging of XSLT documents. The XSLT Profiler allows developers to measure, evaluate, and target performance-related problems in XSLT code by creating detailed XSLT performance reports. The XSLT Profiler includes a wealth of useful hints for XSL and XSLT style sheet optimizations, which are essential for XSLT-based applications that demand maximum performance

Features:

XSLT Profiler analysis is essential for developers if they need to develop reliable and robust software. The XSLT Profiler is capable of detecting the performance errors and defects in coding so that they are corrected at an early stage in the development, essential in reducing the overall cost of developing software applications. The XSLT Profiler tool is fully integrated into Microsoft Visual Studio 2008 to provide a seamless and approachable user experience, combining several Microsoft technologies, including Microsoft XML Editor and XSLT Debugger, Visual Studio Team System, F1 (Performance Suites), and more.

Installation

Note: The XSLT Profiler is targeted only for the Microsoft Visual Studio 2008 Team System with the Performance Tools feature installed.

Make sure that you have Visual Studio 2008 RTM Team System with the Performance Tools feature installed successfully on the computer before running the XSLT Profiler’s setup. If the setup fails and reports that one or more of the required files are missing, try reinstalling Visual Studio 2008 RTM Team Suite with the Performance Tools feature. The XSLT Profiler tool looks for registry entries of the installation; copying only the necessary files for the tool to run. The installation program will be unable to detect whether Performance Tools are installed or not, and when the tool is executed, the execution will fail due to missing instrumentation and profiling features.

Before running setup, ensure that no instances of Visual Studio are running. To install the XSLT Profiler, download and run the setup.

image1.gif

  1. In the Welcome dialog box, click Next and the new wizard page will be displayed.
image2.gif
  1. Read the End-User License Agreement, click the acceptance check box to accept it, and then click Next
image3.gif
  1. Leave the default install location (or customize) and click Next
image4.gif
  1. Click the Install button to start the installation. When complete, click Finish in the confirmation dialog:
image5.gif
  1. When complete, click Finish in the confirmation dialog box.

Now, the XSLT Profiler is available on your computer. To validate this, open the Add-in Manager in Visual Studio (in the Tools menu, click the Add-In Manager option).

image6.gif

If the installation was successful, the XSLT Profiler will be available in the list and checked.
If the XSLT Profiler fails to load in Visual Studio, open a Visual Studio 2008 Command Prompt and run the command:
Devenv /ResetAddin XsltProfiler.Connect

At some rare instances even though the XSLT Profiler is installed correctly, and loaded with VS, but does not show up on the XML Menu, you may want to see if the XSLT Profiler command is available at the Tools --> Commands --> Addins --> Profile XSLT. If this command is available at this location, you may drag it to any command bar of your convenience to add the Profile XSLT command button.

To uninstall the XSLT Profiler, click the Remove button in the Add/Remove Programs dialog box:

image7.gif

Usage

The XSLT Profiler is fully integrated with the Visual Studio UI and offers similar form and usage to that of other performance tools in Visual Studio. Note that the performance tuning is only relevant to XslCompiledTransform when using the XSLT Profiler. Other processors may show completely different results.

After opening an XSLT document in Visual Studio, a new option will be available in the XML menu, called Profile XSLT:

image8.gif

To get started using the XSLT Profiler, open an XSLT document and choose the Profile XSLT option in the XML menu. Note that an input XML document is also required; if it is not already provided, you will be prompted for the file.

image9.gif

As soon as the analysis starts, a notification displays the progress within the document. The XSLT output is visible in the output pane.

Performance Report Overview

After a performance session ends, the data gathered during profiling is saved in a performance report. A performance report allows you to view and analyze XSLT performance problems.

image10.gif

Performance reports have several views that can be changed from the Current View drop down list.

Summary View

By default, a performance report is displayed in the Summary view. This view is a starting point in your investigation to determine performance issues with your XSLT documents. The Summary view lists the following data points:
  • Most called functions
  • Functions with the most individual work
  • Functions taking the longest

image11.gif

By default, there are three columns for each data point: Name (of the function), and the Number of Calls in absolute value and in percentage value. From each data point in the Summary view, you can navigate to more detailed views by right-clicking on the function data points.

Function View

The Function view lists functions called during profiling. You can sort the data by clicking a column name. The columns displayed by default are:
  • Function Name
  • Elapsed Inclusive Time
  • Elapsed Exclusive Time
  • Application Inclusive Time
  • Application Exclusive Time
  • Number of Calls

image12.gif

All time columns are displayed in both absolute values and percentages. The term “exclusive” refers to the total time a function spent executing and does not include time spent by other functions that were called during the execution of this function.

The term “inclusive” refers to the total time a function spent executing, including execution time of all the functions it called and whether any of those called functions called other functions in turn.

Caller/Callee View

The Caller/Callee view has the following three distinct parts:
  • Functions That Called: All the functions that called a particular function are listed at the top part of the view.
  • Current Function: The particular function that was called is listed in the middle part of the view.
  • Functions That Were Called by: All the functions that were called by the particular function are listed at the bottom part of the view.

image13.gif

If a function named SyncToNavigator appears in the middle part of the view, all the functions that called the SyncToNavigator function appear in the top part of the view and all the functions that were called by the SyncToNavigator appear in the bottom part of the view.

You can change the function in the middle part of the view by double-clicking any of the function listed in the other two parts of the view. The view is then updated automatically to reflect the changes.

You can also sort the data by clicking column names.

Calltree View

This view is a tree view of program execution.

image14.gif

The Calltree view shows the root of the tree as the process name and the functions are the nodes of the tree. This view allows you to drill into specific call traces and analyze which traces have the greatest performance impact. The view is similar to the call stack view found during the debugging application. In addition to the columns you saw in the Function view (Function Name, Elapsed Inclusive Time, Elapsed Exclusive Time, Application Inclusive Time, Application Exclusive Time, Number of Calls), in the Calltree view, there is an additional column to display the Module Name.

Marks

With The XSLT Profiler, we have the concept of “marks” that show up in the data collection stream with a comment associated with them. When you tell the XSLT Profiler to collect XSLT performance counters, the counters get collected every time one of these marks gets executed. The data is displayed in a table containing the Mark ID, Mark Name (Start Program, End Program), and the Time Stamp. The “marks” are not aggregated and show up in chronological order in the “Marks” view of the performance report..

image15.gif

Modules

The Modules view is a flat list of all functions aggregated to the module level. Expand or collapse the module name to display or close the view of module performance data. You can sort the data by clicking a column name. By default, there are both absolute values and percentage numbers for Elapsed Inclusive Time, Elapsed Exclusive Time, Application Inclusive Time, Application Exclusive Time, and Number of Calls.

image16.gif

Process

The Process view displays a table that includes the Process ID, Process Name, Begin Time, and the End Time. Data can be sorted by clicking column names.

image17.gif

Enabling FastCaps

If you would like to have more detailed results on Performance Reports, please add the following key to registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\XsltProfiler
"EnableFastCaps"="1"
As you can see the reports will start to include all System.Xml runtime calls as well. The better analysis of System.Xml runtime will lead to better performing XSLT Instructions.


Conclusion

The new XSLT Profiler add-in for Visual Studio 2008 is essential for measuring, evaluating, and targeting performance-related problems. Feedback and suggestions are welcome to the Discussions section of this site.
Last edited Feb 21 2008 at 4:35 AM  by sinanu, version 9
Updating...
Page view tracker