Retrace will reach End of Life on March 31, 2027. Click here to learn more.

How to Troubleshoot Performance with a Visual Studio Profiler

  |  August 2, 2021
How to Troubleshoot Performance with a Visual Studio Profiler

Performance profilers mainly aid developers in analyzing the performance of applications. The purpose is to improve poorly performing sections of code that make up the functions of the application. When you say performance profilers, common names that come to mind are Visual Studio performance profilers and Prefix by Netreo.

In this article, we will focus on the specific Visual Studio profiling tools for memory and CPU usage.

Visual Studio Performance Profiler: Memory and CPU Usage

Visual Studio (VS) is an integrated development environment (IDE) used for many software development aspects and includes a suite of profiling tools. The VS performance profiler is like a world of its own with multiple performance profiling tools for troubleshooting issues and improving application performance. 

If you want to learn more about the different VS performance profiling tools, read about the Top Visual Studio Profiling Tools.

Two of the most commonly used tools within the suite are Memory Usage and CPU Usage tools, because a slow application typically results from memory and CPU issues. Though it does not apply at all times, these two are the most common culprits.

Memory Usage  

Memory profiling tools are essential when profiling application performance. For the VS performance profiler, the Memory Usage tool is your go-to tool. The Memory Usage tool runs smoothly with .NET Core-managed scenarios and is best in locating memory leaks, code pathways allocating a lot of memory and many other issues.

CPU Usage  

The CPU Usage tool is another staple for VS and measures two basic things. First is the percentage of CPU utilization over time or the percentage of your total CPU usage. The second is the number of times a call to action function appears on the call stack over time.

How to Troubleshoot Performance with VS Performance Profiler

Within the Visual Studio performance profiler you will find profiling tools such as CPU Usage, Database, Events Viewer, Memory Usage, dotNET Object Allocation Tracking, .NET Async, .NET Counter and GPU Usage. Let’s take a closer look at troubleshooting with our two key usage tools.

Troubleshooting Memory Usage  

The Memory Usage tool runs with or without a debugger. When using the Visual Studio performance profiler, you will run without a debugger. Profiling and troubleshooting with the Memory Usage tool is recommended mostly for release builds.

Memory Usage Diagnostics

  1. Set solution to Release. Select Local Windows Debugger (Local Machine). Since Memory Usage in the VS Performance Profiler runs without a debugger, you need to switch to a Release configuration. You will see a warning sign under Analysis Target, signaling that you need to switch to Release mode
  2. Select Debug > Performance Profiler. Or you can simply click Alt + F2
  3. You will see the summary page. Under Available Tools, select Memory Usage
  4. Click Start
  1. The diagnostic session starts and the window displays a graph indicating your application’s memory use
  2. Take snapshots during the session to capture the memory usage for particular moments, such as large spikes. Take snapshots before a memory issue appears and another image after the occurrence of the problem. These provide concrete data for comparison to help identify the possible source of problems
  3. After collecting snapshots and appropriate data, select Stop Collection
  1. The page will display Memory Usage reports

Troubleshoot CPU Usage  

There are two main actions to take when troubleshooting using the CPU Usage tool: data collecting and analyzing.

Collecting CPU Usage Data

  1. Select Debug > Performance Profiler. Or, you can simply click Alt + F2
  2. Now, you will see the summary page. Under Available Tools, select CPU Usage
  3. Click Start
  1. The diagnostic session begins, and you will see a graph similar to what appears below. This displays the CPU usage data. Once data collection is complete, select Stop Collection at the upper left corner of the page
  1. Afterward, the CPU Usage tool analyzes the data and displays the report. The report shows bottlenecks or potential CPU issues that affect application performance

Analyzing CPU Usage report

The above image shows the CPU Usage data report. You can see two groups: Top Functions and Hot Path. Under Top Functions are application functions that are taking up a lot of the CPU. The Hot Path shows areas of the code that also use a lot of the CPU’s resources. Through these reports, developers can pinpoint which areas should be optimized.

Call Tree Structure

When you click on one of the functions under the functions table, it displays a flat list of called functions but does not show the path of each function. To view the call tree of the report, navigate the Current View dropdown at the upper left corner of the page, select Call Tree.

The flat list instantly changes to the image above. When you click on a function, it shows you the path and views of what transpired during the system execution. You can see the cause of performance issues and whether they stem from the native code, external code or other scenario.

Performance Profiling with Prefix

Memory Usage and CPU Usage tools are essential for basic performance profiling. However, these are not the only tools for performance profiling. You can find more in-depth tools that will give you more granular data for troubleshooting application performance. 

Besides Visual Studio tools, you can also find other reliable code profiling tools that can efficiently help you, including the developer’s most reliable sidekick, Prefix.

Prefix is one of the world’s most dynamic code analysis tools. Profiling with Prefix can help even the most experienced developers when it comes to optimizing slow SQL queries, hidden exceptions and a host of other code issues. What’s better is that it works for PHP, .NET Core, Python, Node.js, Java and Ruby. 
You don’t have to face another coding nightmare because Prefix can quickly back you up. DOWNLOAD PREFIX FOR FREE TODAY!

Improve Your Code with Retrace APM

Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.

Learn More
indobet toto slot toto toto bobatoto daftar logototo patentoto situs toto slot 4D toto bayitoto popotogel prize hongkong malam ini joker11 lingkartoto depo 5k slot sbobet88 sbobet88 https://nolimithoki.dev/ dinasti33 slot slot jepang https://www.juara288.asia/ slot 4d toto toto situs toto flokitoto slot gacor logototo slot depo 5k bobatoto bobatoto bobatoto sontogel mpo slot situs toto slot situs slot bobatoto kari4d kari4d kari4d kari4d pascol4d pascol4d pascol4d slot gacor bento11 link slot gacor toto toto slot toto situs slot situs slot situs slot https://www.asupan188.dev/ slot gacor gampang menang toto slot gacor bwo303 situs toto toto slot slot gacor slot88 slot gacor situs slot link slot slot gacor pucuk4d PASCOL4D situs slot link slot pajaktoto slotvip situs toto toto slot situs slot situs slot situs slot toto slot gacor slot777 situs slot link slot situs judi bola POPOTOGEL : Situs Resmi Bandar Toto Togel Macau dengan Prediksi Gokil Pasti Akurat link slot slot gacor situs slot slot gacor slot gacor situs slot link slot gacor Slot88 Slot88 slot gacor situs toto toto slot pulsa slot777 link slot gacor situs gacor slot gacor leon188 slot gacor slot gacor slot gacor Slot88 slot gacor situs slot slot gacor Slot88 slot gacor slot terbaru slot gacor situs gacor situs slot slot gacor situs slot Situs Slot POPOTOGEL: Regulasi Bandar Situs Togel Resmi & Bola Mix Parlay Asia Terpercaya StreamEast Jpmania slot resmi slot slot resmi slot bayitoto patentoto link gacor slot gacor kari4d slot gacor AMANAHTOTO slot gacor slot gacor AMANAHTOTO pascol4d kari4d AMANAHTOTO kari4d bragatoto dokter88 slot gacor slot game patentoto pucuk4d rokokbet rokokbet kari4d pascol4d LOGIN PASCOL4D pucuk4d roma77 judi bola slot depo 10k mpo slot Girang4d KARI4D StreamEast AMANAHTOTO jutatoto PARLAY slot88 slot depo 5k hoki99 pascol4d pkv games roma77 Slot poker slot
indobet toto slot toto toto bobatoto daftar logototo patentoto situs toto slot 4D toto bayitoto popotogel prize hongkong malam ini joker11 lingkartoto depo 5k slot sbobet88 sbobet88 https://nolimithoki.dev/ dinasti33 slot slot jepang https://www.juara288.asia/ slot 4d toto toto situs toto flokitoto slot gacor logototo slot depo 5k bobatoto bobatoto bobatoto sontogel mpo slot situs toto slot situs slot bobatoto kari4d kari4d kari4d kari4d pascol4d pascol4d pascol4d slot gacor bento11 link slot gacor toto toto slot toto situs slot situs slot situs slot https://www.asupan188.dev/ slot gacor gampang menang toto slot gacor bwo303 situs toto toto slot slot gacor slot88 slot gacor situs slot link slot slot gacor pucuk4d PASCOL4D situs slot link slot pajaktoto slotvip situs toto toto slot situs slot situs slot situs slot toto slot gacor slot777 situs slot link slot situs judi bola POPOTOGEL : Situs Resmi Bandar Toto Togel Macau dengan Prediksi Gokil Pasti Akurat link slot slot gacor situs slot slot gacor slot gacor situs slot link slot gacor Slot88 Slot88 slot gacor situs toto toto slot pulsa slot777 link slot gacor situs gacor slot gacor leon188 slot gacor slot gacor slot gacor Slot88 slot gacor situs slot slot gacor Slot88 slot gacor slot terbaru slot gacor situs gacor situs slot slot gacor situs slot Situs Slot POPOTOGEL: Regulasi Bandar Situs Togel Resmi & Bola Mix Parlay Asia Terpercaya StreamEast Jpmania slot resmi slot slot resmi slot bayitoto patentoto link gacor slot gacor kari4d slot gacor AMANAHTOTO slot gacor slot gacor AMANAHTOTO pascol4d kari4d AMANAHTOTO kari4d bragatoto dokter88 slot gacor slot game patentoto pucuk4d rokokbet rokokbet kari4d pascol4d LOGIN PASCOL4D pucuk4d roma77 judi bola slot depo 10k mpo slot Girang4d KARI4D StreamEast AMANAHTOTO jutatoto PARLAY slot88 slot depo 5k hoki99 pascol4d pkv games roma77 Slot poker slot