Test Graphics Performance of XAML for Windows Embedded (Compact 2013)

10/26/2015

Before you tune the graphics performance of XAML for Windows Embedded, you must test your shell and applications to discover what your key performance issues are.

To test graphics performance correctly during design and development, do the following:

  • Verify the performance of the XAML in a XAML for Windows Embedded application on device hardware while you design the XAML.
  • Use the XAML for Windows Embedded Performance test suite to gather performance data such as load time, frames per second (FPS), and memory and CPU usage data.

These techniques are described in the following sections.

Prerequisites

To verify graphics performance of XAML for Windows Embedded XAML, you must have Windows Embedded Compact 2013 installed on the same computer on which you use Blend. You must also have a hardware board connected to the computer and a display screen for the hardware board, and you must set up a build configuration in which you can update the XAML for Windows Embedded application project, rebuild the application, and then download the application to the hardware board.

For more information about the tools that you use to create and build XAML for Windows Embedded applications in Platform Builder, see Getting Started with XAML for Windows Embedded.

Manually Test the Graphics Performance of XAML on a Device

To verify the graphics performance of XAML, you interact with the UI that you created in XAML, while the UI is running on your device hardware.

Do not wait until you finish the design of the XAML for Windows Embedded XAML to test it on the device hardware. Instead, test the XAML UI periodically on the device hardware as you would test the XAML periodically in Blend for Visual Studio.

By testing the performance of the XAML regularly, you can refine it to improve the user experience with the visual design and graphics performance.

When you download the XAML to the device hardware, make sure that the hardware board contains the components you expect to use in the production device.

Note

Alternatively, you can load the XAML on a virtual CEPC. However, the virtual CEPC does not support hardware acceleration, which is required for OpenGL or DirectDraw graphics rendering and bitmap caching. However, you can still use the virtual CEPC to analyze resource usage of the XAML.

To verify graphics performance of Silverlight XAML

  1. In Blend, save any changes to your XAML project.

  2. In Microsoft Visual Studio 2013 or Microsoft Visual Studio 2015, open your OS design project.

  3. Open the subproject for the XAML for Windows Embedded application for which you have designed XAML.

  4. Open a XAML source file that belongs to the XAML for Windows Embedded application.

  5. On the Tools menu, point to **Windows Embedded XAML Tools **, and then click Update XAML for Windows Embedded Project.

  6. On the File menu, click Save All.

  7. Rebuild your XAML for Windows Embedded application. In Solution Explorer, right-click the application subproject name and then click Rebuild.

  8. Update the OS design to include support for device connectivity as follows:

    1. In Catalog Items View, type SYSGEN_SHELL in the Search box, click the green arrow box, and then check the Target Control Support (Shell.exe) box.
    2. Repeat the previous step for any other catalog items required for device connectivity, as described in Tools Catalog Items and Sysgen Variables.
  9. Save all files, rebuild your OS design project, and make the OS image.

  10. Download the OS image to the hardware board.

  11. Load the application by using Target Control as follows:

    1. On the Target menu, click Target Control.
    2. At the command line, type s <application_name>.
  12. Interact with the UI on the display screen attached to your hardware board. When you test the XAML UI, observe the following:

    • How long it takes to start the XAML for Windows Embedded application.
    • How long it takes to load individual controls in the application window.
    • How long it takes to load bitmap images in the application window.
    • How long it takes the UI to respond to gestures (if you implemented gestures).
    • Whether animations run efficiently or slower than expected.
    • Whether video runs efficiently or slower than expected.
    • How long it takes to scroll through a list (if you implemented a list box).

Use the performance data that you gather from interacting with the UI to decide which aspects of your Silverlight UI to tune for graphics performance. Also, use the Windows Embedded Compact Test Kit (CTK) XAML for Windows Embedded Performance test suite or the Performance Monitor (XRMon.exe) to gather performance metrics.

Use the CTK to Test the Shell and Applications to Obtain Performance Data

The Windows Embedded Compact Test Kit (CTK) includes the XAML for Windows Embedded Performance test suite, a set of test cases that you use to obtain UI performance data for applications that are based on XAML for Windows Embedded. These applications can include the sample home screen, Windows Embedded Compact applications such as Media Player and Photo Viewer, and your custom XAML for Windows Embedded applications.

You can use the XAML for Windows Embedded Performance test suite to measure performance metrics for XAML for Windows Embedded applications that run on the device hardware. Performance metrics include the following:

  • Time to load XAML
  • Amount of memory used to load XAML
  • Time to render the first frame
  • FPS for running an animation
  • FPS for resizing an image
  • FPS for list box interaction
  • FPS for screen transitions

For more information about the CTK, see Compact Test Kit Overview.

Run performance tests to determine your key graphics performance issues and what types of changes to implement. Then, tune graphics performance by using the guidelines in the following section.

To use the XAML for Windows Embedded Performance test suite, you must include support for CEPerf in your OS image.

To add support for CEPerf

  1. In Platform Builder, on the Project menu, click <OSDesignName> Properties.

  2. Expand Configuration Properties, and then click Build Options.

  3. Set Include CEPerf to Yes (IMGCEPERF=1).

  4. Click OK.

  5. Rebuild the OS image.

You can follow the instructions in the Compact Test Kit (CTK) to run the test cases available in the Shell node of the CTK test catalog. To create a test case for your custom application, use the following instructions.

To create a test for your XAML for Windows Embedded application

  1. In the Windows Embedded CTK application, click File, point to New, and then click Test Case.

  2. Click the (+) icon to expand Windows Embedded Test Catalog.

  3. Click the (+) icon to expand Shell.

  4. Click the (+) icon to expand **XAML for Windows Embedded **.

  5. Select Applications Load - Browser.

  6. On the Test Case Information tab, click New.

  7. In Name, type a name for your test. For example, type "Applications Load - XAML Application."

  8. In Run type, click Fully Automated.

  9. In Test harness, click Tux.

  10. In Command line, replace the text with the command-line argument for your test. For example, replace the text with the following:

    -o -d XRAppLoadTests.dll -c "processname=<app_name> waittime=15 closewindow"
    
  11. In the text, replace <app_name> with the name of the application .exe file.

  12. In Supported architecture, double-click the microprocessor architecture for your hardware board.

  13. Click Browse.

  14. Browse to C:\Program Files (x86)\WindowsEmbeddedCompact2013TestKit\tests\target\<supported_architecture>.

  15. Select the test to run on the application. Silverlight tests are prefixed with "xr." For example, choose xrapploadtests.dll.

  16. Click Open.

  17. Click OK.

  18. Click Advanced.

  19. In List command line, replace the text with the list command line for your test. For example:

    -o -d XRAppLoadTests.dll -c "processname=<app_name> waittime=15 closewindow" -l
    
  20. Click OK.

  21. Click Save.

After you complete these steps, follow the instructions to run the test and gather performance data by using the Graph Tool.

For reference information about the tests available in the XAML for Windows Embedded Performance test suite, see Shell Tests in the Windows Embedded Compact 2013 documentation.

Use the performance data that you gather from the tests to decide which aspects of your XAML for Windows Embedded UI should be tuned for graphics performance. Then, use the guidelines in the following section to tune graphics performance.

XAML for Windows Embedded Performance Tool (XRMon.exe)

You can also use the XAML for Windows Embedded Performance Tool (XRMon.exe) to collect graphics performance information for a XAML for Windows Embedded shell or application. You use XRMon.exe to test performance on devices that use the following processor types:

  • ARMv5
  • ARMv6
  • ARMv7
  • MIPS II
  • MIPS II Floating Point
  • x86

Note

ARMv5, ARMv6, MIPS II, and MIPS II Floating Point processor types are not supported in Windows Embedded Compact 2013.

To download XRMon.zip, which you use to extract XRMon.exe to a folder on your computer, see Silverlight for Windows Embedded Performance Tool: XRMon.

After you download XRMon.zip and extract its contents, follow the instructions for running the tool in the XRMon.pdf white paper, located in the root directory of the folder to which you extracted the contents of the XRMon.zip file.

XRMon.exe provides performance counters that are designed to collect specific performance metrics, as described in the following section.

Performance Counters

You can specify performance counters to obtain performance data on specific XAML for Windows Embedded methods or graphics-rendering operations. By using performance counters with XRMon.exe, you can create CEPerf sessions for gathering specific types of performance data.

After you run XRMon.exe with performance counters, the CEPerf session output is included in the .txt file that you create by using the instructions in the XRMon.pdf white paper, which is installed with the tool.

To use performance counters

  1. Download a run-time image to your device. For more information, see Design an OS.

  2. In Platform Builder, on the Target menu, click Target Control.

  3. At the command prompt, run XRMon.exe by following the instructions in the XRMon.pdf white paper.

  4. When you run XRMon.exe, use one or more EnableSession flags. EnableSession supports the following values:

    EnableSession argument

    Description

    API_Application

    Creates a CEPerf session for gathering performance data on the duration of time spent in calls to the following methods: Initialize, LoadCore, CreateHostFromElementTree, CreateHost, CreateHostFromXaml, CreateObject, AddResourceModule, RemoveResourceModule, LoadImageFromFile, ResolveResourceToSurface, ParseXaml, and ParseXamlWithExistingRoot.

    API_Host

    Creates a CEPerf session for gathering performance data on the duration of time spent in calls to the following methods: GetRootElement, GetFocusedElement, and HandleGestureEvent.

    API_Factory

    Creates a CEPerf session for gathering performance data on the duration of time spent in calls to class factory methods such as RegisterCustomControlFactory, ResolveCustomPropertyName, RegisterObject, and ResolveAttachedProperty.

    API_Render

    Creates a CEPerf session for gathering performance data on the duration of time spent in a method call for graphics rendering methods that include handling the WM_PAINT window message, advancing animations, and drawing on a surface.

    API_Render_FirstPaint

    Creates a CEPerf session for gathering performance data on the duration of time prior to starting an application that occurs before the first WM_PAINT window message is handled.

    API_MessageQueue

    Creates a CEPerf session for gathering performance data for any XR_HOOKPROC procedures.

    API_Render_FrameRate

    Creates a CEPerf session that uses animation frame-rate performance counters for reporting statistics such as current frame rate, average frame rate, and short animation frame rate for animations less than 1,000 milliseconds.

    Core_Layout

    Creates a CEPerf session for gathering performance data on updating the layout of UI elements.

    Core_Render

    Creates a CEPerf session for gathering performance data on graphics-rendering operations including rasterizing, presenting, and composing graphics primitives on a display screen.

The following example command shows how to run XRMon.exe with the API_Application CEPerf session:

>s xrmon -process=TestApp -enablesession=API_Application @release\ttl.xrmon

See Also

Concepts

Graphics and Performance in XAML for Windows Embedded