The default Windows Phone emulator offers plenty of ways to monitor your application's performance, but in this quick tip you'll learn how to monitor the total
memory usage of your application when your emulator can't.
Out of the box the WP7 emulator offers a way to monitor some performance aspects of a WP7 app by providing the following counters:
- Render thread FPS
- User interface FPS
- Texture memory usage
- Surface counter
- Intermediate texture count
- Screen fill rate
The counters are turned on by default and can be manually turned off by removing the following line in App.xaml.cs (or by changing the flag to false):
Jeff Wilcox has a great article about the different performance counters and it can be reached from his blog.
What is missing from the emulator is a way to monitor the total memory usage of your application. WP7 app shouldn’t use more than 90MBs of RAM so monitoring the mem usage is crucial. Thankfully, Peter Torr comes to the rescue. He has published a class called MemoryDiagnosticsHelper which adds a total memory usage counter to the application. It’s really easy to use and it blends nicely with the built-in performance counters.
To use the MemoryDiagnosticsHelper, first download it from the Peter’s site. Add the class into your project and then add the following line in your App.xaml.cs, just after the line where the EnableFrameRateCounter is set:
And that’s all that is required. Now you can start your application and see the total memory usage.