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

  1. 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.

  2. Initialize the TIP environment variables. Type the following command:

    vsperfclrenv /interactionon
    
  3. Start the profiler. Type the following command:

    vsperfcmd /start:sample /output:Desktop_sample.vsp 
    
  4. Start the application with VSPerfCmd. Type the following command:

    vsperfcmd /launch:DesktopApp.exe
    
  5. Exercise the application to collect profiling data, and then close the application in the regular way.

  6. 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

  1. If necessary, install the service.

  2. 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.

  3. Initialize the .NET profiling environment variables. Type the following command:

    vsperfclrenv /globalsampleon
    
  4. Initialize the TIP environment variables. Type the following command

    vsperfclrenv /globalinteractionon
    
  5. Restart the computer to register the environment variables.

  6. Open a command prompt window with Administrator privileges.

  7. Start the profiler. Type the following command:

    vsperfcmd /start:sample /output:MiddleTier_sample.vsp /user:SYSTEM /crosssession 
    
  8. If necessary, start the service.

  9. Attach the profiler to the service. Type the following command:

    vsperfcmd /attach:MiddleTier.exe /output:MyService_sample.vsp /user:SYSTEM /crosssession 
    
  10. Exercise the service and collect profiling data.

  11. Stop the profiler. Type the following command:

    vsperfcmd /detach

  12. Clear the .NET and TIP profiling environment variables. Type the following command:

    vsperfclrenv /globaloff
    
  13. Restart the computer to register the cleared environment variables.

For more information, see one of the following topics:

Command-Line Profiling of ASP.NET Web Applications

Command-Line Profiling of Services