Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Profile Visual C++, Visual C#, and Visual Basic code in Windows Store apps on a local machine

In Visual Studio, the CPU Sampling profiler for Windows Store apps let you measure, evaluate, and target performance-related issues in your code. The profiler collects timing information for apps that are written using Visual C++, Visual C#, and Visual Basic by using a sampling method that collects CPU call stack information at regular intervals. (You can also profile managed and native components of an app that was written in JavaScript and HTML5). Profiling report views display graphical and tabular representations of detailed, context-rich information about the performance of your app and help you navigate through the execution paths of your code and the execution cost of your functions so that you can find the best opportunities for optimization. You can collect profiling information from the start to finish of a profiling run, or you can collect performance only for those scenarios that you are interested in.

Note Note

This topic describes how to profile XAML and Visual C++, Visual C#, or Visual Basic code in Windows Store apps on the machine where Visual Studio is installed.

In many cases, you can collect profiling data for an app in a few steps.

However, the Visual Studio profiler does use the debug settings of the project to configure deployment of the app on the local machine. If you have changed any of the standard debug settings of your project, you should first make sure that the settings are compatible with profiling. See (Optional) Configure the debug properties of the project in this topic for more information.

Five-step profiling

  1. Profile the Release version of your app Choose Release from the Solution configuration drop-down list on the standard toolbar.

    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.

  2. Select the local machine as your deployment target.

    Note Note

    We do not recommend profiling in the simulator because the simulator can distort the performance of your app.

    Run on Local Machine

    To run the app on the local machine, choose Local Machine from the drop-down list next to the Start Debugging button on the Visual Studio Standard toolbar.

    You can also set the host in the property pages of your app project. See Run Windows Store apps on the local machine.

  3. Start the profiler. Choose Performance and Diagnostics on the Debug menu, (keyboard: ALT + F2. Choose CPU Sampling and then choose Start.

    Choose CPU Sampling
  4. Exercise the app. Run those parts of the application that you want to profile. Repeat key scenarios to get more accurate results.

  5. Stop profiling. In the Performance and Diagnostic document window, choose Stop collection (keyboard: CTRL + ALT + F2).

    Stop collecting data

When you stop the profiling run, the profiler analyzes the data and displays the Summary view of the profiling data in a document window of the IDE. See Analyze performance data for Visual C++, Visual C#, and Visual Basic code in Windows Store apps.

If you have changed the properties on the Debug (Visual C++) or Debugging (Visual C# and Visual Basic) project property page,, you should reset them to the following values. Values marked as N/A are ignored by the profiler:

Visual C++

C++ Debug property page

Property

Value

Debugger to launch

Local Debugger

Launch Application

Yes

Allow Local Network Loopback

N/A

Debugger Type

N/A

Visual C# / Visual Basic

C++ / VB Debugging property page

Property

Value

Do not launch, but debug my code when it starts

Clear this check box

Allow Local Network Loopback

N/A

Target device

Local Machine

Remote machine

N/A

Use authentication

N/A

Uninstall and re-install my package. All information about the application state is deleted

Clear this check box

Debugger Type

N/A

To profile the current Visual Studio solution or project:

  1. Choose Performance and Diagnostics on the Debug menu, (keyboard: ALT + F2.

  2. Choose CPU Sampling and then choose Start.

  3. Exercise the app. Run those parts of the application that you want to profile. Repeat key scenarios to get more accurate results.

  4. Stop profiling. In the Performance and Diagnostic document window, choose Stop collection (keyboard: CTRL + ALT + F2).

You can also collect profiling data for native or managed code for an app that is already running on your machine, or for an app that has been installed from the Windows Store:

  1. Choose Performance and Diagnostics on the Debug menu, (keyboard: ALT + F2.

  2. Choose Change Target and then choose Running App or Installed App from the Analysis Targets list.

    Change Target list
  3. From the Select Running App dialog box, choose the app that you want to profile.

    Select Running App dialog box
  4. Choose CPU Sampling and then choose Start.

  5. Exercise the app. Run those parts of the application that you want to profile. Repeat key scenarios to get more accurate results.

  6. Stop profiling. In the Performance and Diagnostic document window, choose Stop collection (keyboard: CTRL + ALT + F2).

When you stop the profiling run, the profiler analyzes the data and displays the Summary view of the profiling data in a document window of the IDE. See Analyze performance data for Visual C++, Visual C#, and Visual Basic code in Windows Store apps.

Show:
© 2015 Microsoft