Using the Profiler to identify hot spots

The C++ Profiler is extremely useful for finding sections of code that require a high amount of processing time. Using the Profiler can help you find sections of code to focus on during optimization. If you suspect that a region of code runs slowly, then you can actually confirm that it isn't slow if it doesn't appear highlighted in the Profiler.

How to do it...

  1. Go to Debug | Start Diagnostic Tools Without Debugging…
    How to do it...
  2. In the dialog shown in the preceding screenshot, select the type of analysis you'd like displayed. You can choose to analyze CPU Usage, GPU Usage, Memory Usage, or step through a Performance Wizard to assist you in selecting what you want to see.
  3. Click on the Start button at the bottom of the dialog.
  4. Stop the code after a brief time (less than a minute or two) to halt sample collection.

    Tip

    Do not collect too many samples or the Profiler will take a really long time to start up.

  5. Inspect the results that appear in the .diagsession file. Be sure to browse all available tabs that open up. Available tabs will vary depending on the type of analysis performed.

How it works…

The C++ Profiler samples and analyzes the running code, and presents to you a series of diagrams and figures about how the code performed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.177.115