API to get memory/CPU usage
We'd like to have some approach to get process memory usage and CPU usage. So we can measure app works correctly which include:
1. No memory leak
2. No exceed memory budget
3. When something bad happens, we can detect it and either log a error event or try to recover.
We tried traditional Linux ways like check /proc/self/status, or getrusage() or run ps, but none of them been supported with Azure Sphere.
Georgi Angelov commented
"unlock" open() and read /proc/....
Paulfo (MSFT) commented
This is now documented at: https://docs.microsoft.com/en-us/azure-sphere/app-development/application-memory-usage
You can get information about your application's memory usage during debugging with Visual Studio by issuing commands to the Visual Studio MI Debug Engine.
Open a Command Window in Visual Studio by selecting View > Other Windows > Command Window.
Pause the application.
Type the following command in the Command Window prompt:
Debug.MIDebugExec info proc status
This command returns the equivalent of proc/self/stat in Linux.
Thank you for the feedback. We added your request to our feature backlog. We will provide updates as we make progress on this feature.