How to collect performance data for Visual C++, Visual C#, and Visual Basic components in a JavaScript app on a local machine
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
To collect performance data for Visual C++, Visual C#, and Visual Basic components of a Metro style app that are called by JavaScript, you use the VSPerf.exe command line tool even if the device you are profiling on has Visual Studio installed. This topic describes how to collect collect performance data in this scenario.
To profile Visual C++, Visual C#, and Visual Basic components of a Metro style app on a device that does not have Visual Studio installed, see 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.
To profile JavaScript code in a Metro style app on a local machine, see How to collect JavaScript performance data for Windows Metro style apps on a local machine.
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
In this topic
Prerequisites
Profile a release build of your app
Build and deploy your app
Open and the Visual Studio developer 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
Analyze the profiling data
Prerequisites
The following requirements are necessary to use VSPerf.exe on a local machine.
Visual Studio must be installed on the machine.
A Windows 8 developer license must be installed on the machine.
The app to be profiled must be deployed on the machine before you start profiling.
You must have administrator privileges on the machine.
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.
Build and deploy your app
On the Build menu, choose Deploy. Visual Studio builds the app and deploys it to the local machine.
Open and the Visual Studio developer command window
On the Start menu, choose the Developer Command Prompt
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 VSPerf /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 displayed list.
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.
You can use the /noclr option to collect performance data only for native Visual C++ code.
Collect performance data for the entire profiling run
To collect performance data for the entire profiling run, do this:
Start the profiler. At the command prompt, type one of the following commands.
vsperf /app:{AppName} /file:{OutFile} [/noclr]
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 a 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.
To collect performance data for specific scenarios, do this:
Start the profiler with profiling paused. At the command prompt, type on of the following commands:
vsperf /app:{AppName} /file:{OutFile} /pause [/noclr]
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 local machine. 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.
To collect performance data by attaching to a running process, do the following:
Attach the profiler to the process. At the command prompt, type on of the following commands:
vsperf /attach:{PID|ProcessName} /file:{OutFile} [/noclr]
Exercise the scenarios that you want to profile.
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.
Analyze the profiling data
To analyze the performance data in the profiling report file, see Analyzing performance data for Visual C++ , Visual C#, Visual Basic, and code in Windows Metro style apps.