A core feature of Visual Studio that allows developers to inspect, analyze, and troubleshoot code during execution.
Hello @Bar Rose ,
Thank you for reaching out with your question.
To monitor CPU and memory usage while your program runs in Visual Studio, it might be beneficial to explore the built-in profiling tools. Depending on your needs, there are two primary ways to approach this:
1. Using the Diagnostic Tools (During Debugging)
When you start a regular debugging session (typically by pressing F5), the Diagnostic Tools window should automatically appear on the side of your screen. This window provides real-time graphs for both CPU and Memory usage while you step through your code.
Note: If the window is not visible, it is possible it was hidden. You can bring it back by navigating to Debug > Windows > Show Diagnostic Tools (or pressing Ctrl+Alt+F2).
2. Using the Performance Profiler (For detailed analysis)
If you need highly accurate measurements without the extra overhead of the debugger, it might be better to use the Performance Profiler.
- You can access this by going to Debug > Performance Profiler... (or pressing
Alt + F2). - From there, you can check the boxes for CPU Usage and Memory Usage, and then click "Start". This will run your program and collect detailed performance data to review once the program is closed.
For additional context and step-by-step guidance, you may find the following official documentation helpful:
- First look at profiling tools in Visual Studio
- Analyze CPU usage in the Performance Profiler
- Measure memory usage in Visual Studio
I hope this helps you investigate your application's performance. Please let me know if you need any further assistance with these tools. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.