How to collect JavaScript performance data for Windows Metro 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 JavaScript code in a Media style app that is running on a device that does not have Visual Studio installed.

备注

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.

Profiling with VSPerf.exe is useful when you 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 focus your performance profiling on specific scenarios by pausing and resuming data collection. Once 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

Deploy your app to the remote machine

Profiling your app with VSPerf.exe

  • Open a command window

  • Find the app ids

  • Profile the app

    • Specifying start and attach parameters and options

    • Collect performance data for the entire profiling run

    • Collect performance data for specific scenarios

    Copy the profiling report to the Visual Studio machine

    Analyze the performance data

    VSPerf.exe Reference

Prerequisites

The following requirements are necessary to use 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.

备注

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

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 an app that was 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.

Profiling your app with VSPerf.exe

Open a command window

  1. Open a command window in administrator mode.

    1. On the Start menu, type command.

    2. From the Apps list, select Command Prompt.

    3. Right-click and choose Run as administrator.

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

  1. At the command prompt, type:

    vsperf /listapps

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

重要

To profile JavaScript code, you must include the /js option in the command that starts the profiling session.

You can not attach the profiler to the app to collect JavaScript performance data.

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.

  • You can use full or relative paths to specify the report file name in the {OutFile} parameter of the /file option.

Collect performance data for the entire profiling run

  1. If necessary, close any running instances of your app.

  2. Start the profiler. At the command prompt, type

    vsperf /app:{AppName} /file:{OutFile} /js

    Or

    vsperf /package:{PackageFullName} /file:{OutFile} /js

  3. Start your app from the Start menu or by using another method, such as starting the app as a child of another app.

  4. Exercise the app.

  5. Stop profiling. To end a profiling session, you can use either the vsperf /stop or the vsperf /detach command.

    1. Type vsperf /stop to end the profiling session and close the app.

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

  1. If necessary, close any running instances of your app.

  2. Start the profiler with profiling paused.

    vsperf /app:{AppName} /file:{OutFile} /js /pause

    Or

    vsperf /package:{PackageFullName} /file:{OutFile} /js /pause

  3. Start your app from the Start menu or by using another method, such as starting the app as a child of another app.

  4. Just before you start the scenario that you want to profile, type:

    vsperf /resume.

  5. When your scenario is done, type:

    vsperf /pause.

  6. Stop profiling. To end a profiling session, you can use either the vsperf /stop or the vsperf /detach command.

    1. Type vsperf /stop to end the profiling session and close the app.

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

See Analyzing JavaScript performance data in Metro Style apps.

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

Not applicable for collecting JavaScript performance data.

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

See Also

Concepts

Analyzing the performance of Windows Metro style apps

How to collect JavaScript performance data for Windows Metro style apps on a local machine

Analyzing JavaScript performance data in Metro Style apps

How to collect performance data for Visual C++, Visual C#, and Visual Basic components in a JavaScript app on a local machine