How to turn ON/OFF the Frame Rate Counter in #UWP apps?


If you are a developer building apps for Universal Windows Platform, you might have noticed that, at the time of debugging there are some strings of digit getting display just under the title bar of the application. This is called as Frame Rate Counter, which displays frame rate and per frame CPU usage.

 

Today in this small blog post, we will learn how to enable/disable the Frame Rate Counter in your Universal Windows apps. Countinue reading to know more about it.

 

How to turn ON/OFF the Frame Rate Counter in apps for Universal Windows Platform? (www.kunal-chowdhury.com)

 

Frame Rate Counter is a set of few numerics that gets displayed just under the title bar, when the app runs in debug mode. But when this runs in “Release Mode”, you will find that, it’s not visible in the screen. This is default behaviour of the app template that you are executing. Hence you can be assured that, it will not display when some one installs the app from store and runs it; unless you specifically asked it to display all the time.

 

Frame Rate Counter in Windows 10 Universal App (www.kunal-chowdhury.com)

 

The code that enables the Frame Rate Counter in debug mode is generally found in the App.xaml.cs class file. Open the same file and navigate to the OnLaunched event. There you will find the following code: this.DebugSettings.EnableFrameRateCounter set as “true”, when the debugger is attached.

 

If you want to remove the counter getting displayed in the app while running, you can set that property to “false”. More precisely, you can delete the entire code block (marked in rectangular, below) to remove it entirely.

 

Code for Frame Rate Counter visibility in Windows 10 Universal App (www.kunal-chowdhury.com)

 

In case it is require in any place based on conditions, you can set the property to either true or false. Make sure to always check the debugger before calling this property. This way you will be assured that, it will not execute to user’s system when run from the store.

 

I hope that the post was helpful to give you some idea about the Frame Rate Counter and how to make it enable/disable. Don’t just stop here. Read my last post to know How to apply custom color in #UWP apps Title Bar?

 

Subscribe to my blog’s RSS feed and email newsletter to get all the post updates directly deliver to your inbox. I am available on Twitter, Facebook and Google+. Do connect with me to get all the updates that I share over those social networking channels. Happy coding!!!

 


If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter , Facebook , Google+ and LinkedIn . I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.

2 comments

  1. can i changed the default setting to always be off(false) so i can turn it on(true) only when i need it?

    ReplyDelete
    Replies
    1. Just remove the lines from the App.xaml.cs or set it to False.

      Delete


 
© 2008-2016 Kunal-Chowdhury.com - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top