http://msdn.microsoft.com/en-us/library/hh202934(v=VS.92).aspx

Windows Phone Performance Analysis

            Windows Phone

 

December 15, 2011

The Windows Phone Performance Analysis tool is a profiling tool to evaluate and improve the performance of your Windows Phone applications. The Performance Analysis tool is installed as part of the Windows Phone SDK. It is fully integrated into Visual Studio and is accessible from the Debug menu. This topic provides an overview of the Performance Analysis tool and describes how it can help you improve the performance of your Windows Phone applications. To install the Windows Phone SDK, which include the Performance Analysis tool, see Installing the Windows Phone SDK.

 



If you want to create a successful Windows Phone application that users will enjoy, you will need to spend time on performance. Even if you have a great idea for an application, if the application is slow, unresponsive, or periodically crashes, users will stop using it. For more information about Windows Phone performance, see Performance Considerations in Applications for Windows Phone.

In addition to creating a great user experience, Windows Phone applications must meet certain performance requirements to be published in the Marketplace. For example, there are certification requirements regarding the following:

  • Maximum memory usage by the application

  • Application launch time

  • Application responsiveness

You can use a tool such as the Marketplace Test Kit to identify some of the issues, but the Performance Analysis tool will help you determine the source of these issues in your applications. For a complete list and details about these certification requirements, see Technical Certification Requirements. For more information about the Marketplace Test Kit, see Windows Phone Marketplace Test Kit.

The Performance Analysis tool enables you to measure and analyze performance aspects of your applications. The tool enables you to evaluate either execution-related or memory-usage aspects of your application in a single profiling session. Each time you run the Performance Analysis tool, a file is created that contains performance information for that session. When selected, the contents of the file are displayed within Visual Studio and show the results in a series of performance graphs and tables that contain additional information. Because Windows Phone applications must meet certain performance requirements, using the Performance Analysis tool is an important step in preparing your application for submission to the Marketplace.

The following list includes some of the issues you can easily identify using the Performance Analysis tool:

  • Inconsistent application frame rate

  • High CPU usage

  • High memory usage

  • Insufficient garbage collection

The Performance Analysis tool has six performance areas that are displayed in a graph format. Each area is color-coded so it is easy to recognize in the graph. The following image shows an example graph.

The Windows Phone Profiler's "Graphs" area

Each graph entry displays the following information:

Frame rate

Displays the number of screen redraws, in frames per second, the application completed at that point in the timeline. This information is only available for periods in the timeline where the application was updating the display in some way. Windows Phone applications should average between 30 and 60 frames per second.

CPU usage %

Displays the percentage of phone CPU in use while the application was running. CPU usage is indicated by thread type in the graph. The following table lists the thread types.

Thread

Color in Graph

Notes

User Interface (UI) thread

Green

Indicates screen updates and touch inputs. You should try to keep the UI thread to less than 50% of CPU usage.

Application Threads

Purple

Indicates application activity that is not UI. This could be composition thread or background threads.

System Threads

Grey

Indicates activity that is not for the application. A large system thread percentage indicates that the system is busy with other background tasks and is affecting application performance.

Idle Threads

White

Indicates available CPU percentage. The higher the idle thread percentage, the more responsive the application should be.

Memory usage MB

Displays the amount of phone memory being used by the application measured in megabytes.

Storyboards

Displays an S flag on the timeline to indicate the occurrence of storyboard events. Typically a storyboard event indicates the start of an animation. There are two kinds of flags.

  • Red flag indicates a storyboard that is CPU-bound.

  • Purple flag indicates a storyboard that is not CPU bound.

Image loads

Displays an I flag on the timeline to indicate when image assets are loaded into phone memory.

GC events

Displays a G flag on the timeline to indicate when garbage collection occurs. This provides details about when the runtime reclaims memory space that was recently freed.

For more information about how to use the Performance Analysis tool and explore the graph information in more detail, see How to: Capture and Analyze Performance Data Using Windows Phone Performance Analysis.

When you select a portion of the performance graph, a detailed performance analysis section appears. This section provides a Performance Warnings menu to further investigate performance issues as well as details about the performance for the selected time period in a tabular format. The following image shows a section of the graph selected and the resulting display in the detailed performance analysis section.

Windows Phone Profiler, with highlighted timeline

The Observation Summary column contains information and steps that walk you through expanding the menu options of the Performance Warning menu to investigate the details of a performance problem. The following image shows an example of an expanded Performance Warnings menu.

The Windows Phone Profiler's "Breadcrumb" menu

The following is a list of key performance terms you should be familiar with when using the Performance Analysis tool.

Performance Warnings

Notifications of possible performance problems. Warnings are displayed in the detailed performance analysis section.

Sampling

A statistical profiling method that shows you the functions that are doing most of the user mode work in the application by measuring the amount of time an application spends executing the sampled tasks and code paths.

Frame Rate

The number of screen updates rendered at that point in the timeline, expressed in frames-per-second.

CPU Usage

The percentage of available phone CPU capacity in use at that point in the timeline. This information is broken down by thread in the graph display, and can be broken down by method name in the detailed performance analysis section.

Memory Usage

The private working set of phone memory being used by the application at that point in the timeline.

Inclusive Samples

The total number (or percentage) of samples collected during the execution of the indicated (target) method. This includes samples that are collected during the direct execution of the method code and samples that are collected during the execution of child methods that are called by the target method.

Exclusive Samples

The total number (or percentage) of samples collected during the direct execution of the instructions of the indicated (target) method. Exclusive samples do not include samples that are collected during the execution of functions that are called by the target method.

Fill Rate

The total number of pixels on the screen at that point in the timeline.

Texture Count

The number of textures loaded into phone memory at that point in the timeline.

Dirty

The amount of time within the selected time period during which the indicated visual element was obsolete (awaiting rendering update).

Total Draw Time Exclusive

The amount of time (in milliseconds) that was required to render the indicated visual element. This measurement does not include time spent rendering any elements that were children of the indicated element in the visual element hierarchy (tree).

Total Draw Time Inclusive

The amount of time (in milliseconds) that was required to render the indicated visual element. This measurement includes time spent rendering any elements that were children of the indicated element in the visual element hierarchy (tree).

Measure Time Exclusive

The amount of time (in milliseconds) spent sizing and positioning the indicated visual element. This measurement does not include time spent sizing any elements that were children of the indicated element in the visual element hierarchy (tree).

Measure Time Inclusive

The amount of time (in milliseconds) spent sizing the indicated visual element. This measurement includes time spent sizing any elements that were children of the indicated element in the visual element hierarchy (tree).

Arrange Time

The amount of time (in milliseconds) spent positioning the indicated visual element.

Measure Count

The number of iterations required in sizing the indicated visual element in the selected duration.

Arrange Count

The number of iterations required in positioning the indicated visual element in the selected duration.

Texture Update Count

The number of textures being updated in the selected duration.

posted on 2011-12-21 10:00  higirle  阅读(305)  评论(0编辑  收藏  举报