Search code examples
windows-store-appswinrt-xamlframe-rate

How do you enable FPS monitoring for testing XAML animations?


Since Windows Store Apps can run across both the Intel and the ARM architectures, it is important that animations (at least) be as performant as possible. To test animations, FPS is very important. How do you enable FPS monitoring in Windows?


Solution

  • In Windows 8 you do this:

    App.Current.DebugSettings.EnableFrameRateCounter = true;
    

    I like to do it like this:

    App.Current.DebugSettings.EnableFrameRateCounter 
        = System.Diagnostics.Debugger.IsAttached;
    

    The counter UI is documented here (http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.debugsettings.enableframeratecounter.aspx).

    Monitor includes:

    • Cp fps: the frames-per-second frame rate for the composition thread
    • UI fps: the frames-per-second frame rate for the UI thread
    • Memory: memory utilization for textures
    • Batch: the count of surfaces that are sent to the graphics processing unit (GPU)
    • Cp cpu: time in milliseconds spent on the composition thread's processor
    • UI cpu: time in milliseconds spent on the UI thread's processor