How to: Add Tier Interaction Data to Profiling Data From the Command Line
Tier interaction profiling provides additional information about the execution times of synchronous ADO.NET calls in functions of multi-tiered applications that communicate with one or more databases. You can collect tier interaction data with any of the profiling methods.
Note
Tier interaction data can only be viewed in the Visual Studio IDE. File based tier interaction reports through VSPerfReport are not available.
Adding tier interaction data with VSPerfASPNETCmd
The VSPerfASPNETCmd command-line tool enables you to easily profile ASP.NET Web applications. Compared with the VSPerfCmd command-line tool, options are reduced, no environment variables have to be set, and rebooting the computer is not required. These features of VSPerfASPNETCmd make the collection of tier interaction data exceptionally easy.
To add tier interaction to profiling data collected by using VSPerfASPNETCmd, add the /TIP option to the command line. For example, use the following command line to include tier interaction data when you collect application statistics for an ASP.NET Web application by using the sampling method:
vsperfaspnetcmd /tip https://localhost/MyWebApp
For more information about VSPerfASPNETCmd, see Rapid Web Site Profiling with VSPerfASPNETCmd.
Adding tier interaction data with VSPerfCmd
The VSPerfASPNETCmd command line tool lets you access the complete functionality available in the Profiling Tools. To add tier interaction to profiling data collected by using VSPerfCmd, you must use the VSPerfCLREnv utility to set and remove the environment variables that enables tier interaction data. The options that you specify and the procedures required to collect data depend on the type of application that you are profiling.
Profiling stand-alone applications
To add tier interaction data to an application that is not run by another process, such as a Windows desktop application that makes synchronous ADO.NET calls to a SQLServer database, use the VSPerfClrEnv /InteractionOn option to set the environment variables, and the VSPerfClrEnv /InteractionOff option to remove them.
In the following example, a Windows desktop application is profiled by using the sampling method and tier interaction data is collected.
Profiling a Windows desktop application example
Open a command prompt window with Administrator privileges. Click Start, point to All Programs, and then point to Accessories. Right-click Command Prompt, and then click Run As Administrator.
Initialize the TIP environment variables. Type the following command:
vsperfclrenv /interactionon
Start the profiler. Type the following command:
vsperfcmd /start:sample /output:Desktop_sample.vsp
Start the application with VSPerfCmd. Type the following command:
vsperfcmd /launch:DesktopApp.exe
Exercise the application to collect profiling data, and then close the application in the regular way.
Clear the TIP environment variables. Type the following command:
vsperfclrenv /off
For more information, see Command-Line Profiling of Stand-Alone Applications.
Profiling services
To profile services, including ASP.NET applications, use the VSPerfClrEnv /GlobalInteractionOn option to set the environment variables, and the VSPerfClrEnv /GlobalInteractionOff option to remove them.
When you are profiling services, including ASP.NET Web applications, you will often need to restart the computer to enable profiling.
In the following example, a Windows service is profiled by using the sampling method and tier interaction data is collected.
Profiling a Windows service example
If necessary, install the service.
Open a command prompt window with Administrator privileges. Click Start, point to All Programs, and then point to Accessories. Right-click Command Prompt, and then click Run As Administrator.
Initialize the .NET profiling environment variables. Type the following command:
vsperfclrenv /globalsampleon
Initialize the TIP environment variables. Type the following command
vsperfclrenv /globalinteractionon
Restart the computer to register the environment variables.
Open a command prompt window with Administrator privileges.
Start the profiler. Type the following command:
vsperfcmd /start:sample /output:MiddleTier_sample.vsp /user:SYSTEM /crosssession
If necessary, start the service.
Attach the profiler to the service. Type the following command:
vsperfcmd /attach:MiddleTier.exe /output:MyService_sample.vsp /user:SYSTEM /crosssession
Exercise the service and collect profiling data.
Stop the profiler. Type the following command:
vsperfcmd /detach
Clear the .NET and TIP profiling environment variables. Type the following command:
vsperfclrenv /globaloff
Restart the computer to register the cleared environment variables.
For more information, see one of the following topics: