How to collect Visual C++, Visual C#, and Visual Basic performance data for Windows Metro style apps on a device that does not have Visual Studio installed
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
This topic describes how use the VSPerf.exe command-line tool to collect performance data for Visual C++, Visual C#, and Visual Basic code in a Windows Media style app that is running on a device that does not have Visual Studio installed.
Notes
Although it is possible to run VSPerf.exe over a Remote Desktop Connection, we do not recommend it. Executing an app in a remote connection can change the way app performs. For example, an app that can take advantage of hardware acceleration for graphics when the app is run locally must use software rendering when it is run over a remote connection.
On a machine that does have Visual Studio installed, you collect Visual C++, Visual C#, and Visual Basic performance data for a XAML app from the Visual Studio IDE. See How to collect Visual C++, Visual C#, and Visual Basic performance data for Windows Metro style apps on a local machine.
But to collect Visual C++, Visual C#, and Visual Basic performance data from components in a JavaScript and HTML5 app on a machine that has Visual Studio installed, you must use VSPerf.exe. See How to collect performance data for Visual C++, Visual C#, and Visual Basic components in a JavaScript app on a local machine.
You can use VSPerf.exe to collect performance data for Visual C++, Visual C#, and Visual Basic from the following types of Metro style apps:
An app written using XAML and Visual C++, Visual C#, or Visual Basic.
An app written using HTML5 and JavaScript that contains components that are written in Visual C++, Visual C#, or Visual Basic.
Profiling with VSPerf.exe is useful when you want to analyze performance on a device that does not have an installation of Visual Studio. For example, you might want to test the performance on a variety of devices with different capabilities, such as processing speed, screen resolution, or abilities to process different kinds of input gestures.
With VSPerf.exe, you can profile an app that is started from the Start menu or by another process or procedure. You can also profile a running app by attaching to the app process. You can focus your performance profiling on specific scenarios by pausing and resuming data collection. After you have finished profiling, you copy a single file to your Visual Studio machine to analyze the data.
In this topic
Prerequisites
Install the Visual Studio Remote Tools
Profile a release build of your app
Deploy your app to the remote machine
Open a command window
Find the app ids
Profile your app with VSPerf.exe
Specifying start and attach parameters and options
Collect performance data for the entire profiling run
Collect performance data for specific scenarios
Attach to a running app to collect performance data
Copy the profiling report to the Visual Studio machine
Analyze the profiling data
VSPerf.exe Reference
Prerequisites
Here are the requirements for using VSPerf.exe on a remote device.
The app to be profiled must be deployed on the remote machine before you start profiling.
You must have administrator privileges on the remote device.
Visual Studio must be installed on a Windows 8 machine to analyze performance data collected from Metro style apps.
Install the Visual Studio Remote Tools
The remote profiling tool is installed with the Visual Studio Remote Tools, along with the remote debugging components.
You can run or download the Visual Studio Remote Tools setup program from the Microsoft download center. Setup programs are also available on the Visual Studio installation media in subfolders of the vs\Remote Debugger folder. Run the setup program that matches the operating system (x86, x64, ARM) on the remote device.
Notes
Profiling is not supported on ARM devices in Visual Studio 11 Beta.
Operating system |
Microsoft download center |
Visual Studio Media vs\Remote Debugger |
---|---|---|
x86 |
rdbgsetup_x86.exe |
x86\rdbgsetup_x86.exe |
x64 |
rdbgsetup_x64.exe |
x64\rdbgsetup_x64.exe |
ARM |
rdbgsetup_arm.exe |
arm\rdbgsetup_arm.exe |
On the setup dialog, accept the user agreement, and then choose Install.
The remote profiling components are installed on the remote device in the C:\Program Files\Microsoft Visual Studio 11.0\Team Tools\Performance Tools folder on x86 devices. On x64 devices they are installed in the C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools folder.
Profile a release build of your app
Because release builds of your application include all of the compiler generated optimizations that your app will contain when you release it, profiling a release build provides the most accurate information about the performance of your app. To specify a release build, choose Release from the Solution configuration drop-down list on the standard toolbar.
Deploy your app to the remote machine
Your app must be deployed on the remote machine before you run VSPerf.exe. You can profile an app that was installed from the Windows Store or deployed by Visual Studio. If you have debugged your app on the device, the app is already deployed. For more information, see Deploying Windows Metro style apps from Visual Studio.
Open a command window
Open a command window in administrator mode.
On the Start menu, type command.
From the Apps list, choose Command Prompt.
Open the shortcut menu and choose Run as administrator.
Add the VSPerf.exe installation folder to the PATH environment variable:
On x86 devices, type:
set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio 11.0\Team Tools\Performance Tools
On x64 devices, type
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools
Find the app ids
You specify the app that you want to profile by using the VSPerf /app or /package options. You can use the /listapps option to display the exact names and package ids of all the apps on your device.
At the command prompt, type:
vsperf /listapps
Find your app in the list that’s displayed.
Application: BouncingSquares Package: 54fb8cc2-1f58-4fe5-adb1-a246dd54ffa6_1.0.0.0_neutral__fsyyfg9a7tqy4
Use the Application: name as the argument for the /app option. For example:
vsperf /app:BouncingSquares
Use the Package: id as the argument for the /package option. For example:
vsperf /package:54fb8cc2-1f58-4fe5-adb1-a246dd54ffa6_1.0.0.0_neutral__fsyyfg9a7tqy4
Profile your app with VSPerf.exe
Specifying start and attach parameters and options
Use either of the /app:{AppName} or /package:{PackageFullName} options to start the profiler.
See Find the app ids to find the {AppName} and {PackageFullName} parameters.
Use either the process id (PID) or the process name as the parameter for the /attach option. You can find both the PID and process name of the app in Windows Task Manager.
You can use full or relative paths to specify the report file name in the {OutFile} parameter of the /file option.
Use the optional /noclr to collect performance data only for native Visual C++ code.
Collect performance data for the entire profiling run
If necessary, close any running instances of your app.
Start the profiler. At the command prompt, type
vsperf /app:{AppName} /file:{OutFile} [/noclr]
Or
vsperf /package:{PackageFullName} /file:{OutFile} [/noclr]
Start your app from the Start menu or by using another method, such as starting the app as a child of another app.
Exercise the app.
Stop profiling. To end a profiling session, you can use either the vsperf /stop or the vsperf /detach command.
Type vsperf /stop to end the profiling session and close the app.
Type vsperf /detach to end the profiling session and leave the app running.
Collect performance data for specific scenarios
After you have started a profiling session, you can use the vsperf /pause and the vsperf /resume commands to control the data that is collected. You can pause and resume data collection regardless of how you started the profiling session.
You can use these commands to isolate the profiling report to specific scenarios and eliminate data that you are not interested in. For example, you might have complex drawing routine in your app that takes a significant amount of user interaction to set up. You are only interested in optimizing the drawing routine, and you want to ignore the setup interactions. You could start your app with profiling paused and set up the drawing routine. Just before you initiate drawing, use the vsperf /resume command to start data collection. When the drawing is complete, use the vsperf /pause command to suspend data collection. You might repeat the process to collect additional data, and then end the profiling session.
Start the profiler with profiling paused.
vsperf /app:{AppName} /file:{OutFile} /pause [/noclr]
—or—
vsperf /package:{PackageFullName} /file:{OutFile} /pause [/noclr]
Start your app from the Start menu or by using another method, such as starting the app as a child of another app.
Just before you start the scenario that you want to profile, type:
vsperf /resume.
When your scenario is done, type:
vsperf /pause.
Stop profiling. To end a profiling session, you can use either the vsperf /stop or the vsperf /detach command.
Type vsperf /stop to end the profiling session and close the app.
Type vsperf /detach to end the profiling session and leave the app running.
Attach to a running app to collect performance data
Use the vsperf /attach command to profile an app that is already running on the remote device. When you attach to an app, a profiling session is started and data collection begins immediately. You specify the app that you want to profile by using either the process id (PID) or the process name of the app as the argument to the /attach command. You can find both the id and process name of the app in Windows Task Manager.
Attach the profiler to the process. Type:
vsperf /attach:{PID|ProcessName} /file:{OutFile} [/noclr]
Exercise the scenarios that you want to profile.
You can use the vsperf /pause and vsperf /resume commands to target specific scenarios
Stop profiling. To end a profiling session, you can use either the vsperf /stop or the vsperf /detach command.
Type vsperf /stop to end the profiling session and close the app.
Type vsperf /detach to end the profiling session and leave the app running.
Copy the profiling report to the Visual Studio machine
To analyze the profiling data, copy the profiling report (.vspx) file to the Visual Studio machine.
Analyze the profiling data
VSPerf.exe Reference
/app:{AppName} |
Starts the profiler and waits for the specified app to be launched from the Start menu. Run vsperf /listapps to view the app Name and PackageFullName of installed apps. |
/package:{PackageFullName} |
Starts the profiler and waits for the specified app to be launched from the Start menu. Run vsperf /listapps to view the app Name and PackageFullName of installed apps. |
/attach:{PID|ProcessName}[,PID|ProcessName]... |
Collects data from the specified processes. Use Task Manager to view the process id (PID) and process names of running apps. |
/js |
Required for profiling JavaScript apps. Collect performance data from JavaScript apps. Use only with /package or /attach. |
/file:{ReportName} |
Optional. Specifies output file (overwrites existing file). Use only with /package or /attach. |
/noclr |
Optional. Do not collect CLR data. Use only with /package or /attach. Optimization, no managed symbols will resolve. |
/stop |
Stop data collection and terminate the target processes. |
/pause |
Pause data collection. |
/resume |
Resume data collection. |
/stop |
Stop data collection and terminate target processes. |
/detach |
Stop data collection, but let target processes continue to run. |
/listapps |
List installed app Names and PackageFullNames. |
/status |
Show profiler status. |