Profiling a Sample application using VS2010

Let’s start the practical session now. In this example we will profile a simple Win-form application
Create performance session by using the performance wizard as shown in figure 1.


Figure 1: Launch Performance Wizard

Select the profiling method as shown is figure 2

Figure 2: Selecting profiling method

Select the application you want to profile as shown in figure 3

Figure 3: Application selection for profiling

This action will create the performance session.
If you want to start the application and profiling, keep the option selected as shown in figure 4

Figure 4: Performance Session created

Click Finish. It will start running the application and profiling session as well

For every action taken on the application, profiler starts collecting data depending upon the type of profiling. Following are the option you can use while profiling.
  • Pause profiling – to pause the profiling
  • Resume profiling – to resume the paused profiling
  • Stop profiling – to stop the profiling.

To stop profiling you can use “Stop Profiling” or close the application. Profiler starts analyzing the profiler data and creates the .vsp file. This file provides different views of the profiler data (depending upon the type of profiling selected).


Let’s analyze the different views of the profiler reports
Concurrency Profiler Report – Summary Page

The Concurrency Profiler report provides following views·

  • Summary - describes the Summary view and report.
  • Call Tree - displays a hierarchical tree that represents the execution paths and resource contention data of functions in the profiling run.
  • Modules - organizes thread and resource contention data by module and lists the functions, source code lines, and instructions that were executing when blocking events occurred
  • Caller/ Callee - lists thread and resource contention data for a selected function and the functions that called and were called by the selected function.
  • Functions - lists thread and resource contention data by function.
  • Lines - lists resource contention data by source code line.
  • Resource Details - displays a graphical timeline of the blocking events for each contended resource and lists the call stack for the blocking events
  • Thread Details - displays a graphical timeline of the blocking events for each thread and lists the call stack for the blocking events
  • Marks - lists the profiling marks inserted into profiler data files. Also includes Windows performance counter data when the data is collected.
  • Processes - lists resource contention by process and thread.

Figure 5: Concurrency Profiler report
  • Contention - displays a graphical timeline of the profiling data and lists the functions and resources that participated in the most blocking events.
  • Function Details - displays a graphical chart of the relationship between a selected function and the functions that called and were called by the selected function.
  • Instruction Pointers - lists resource contention by instruction.

CPU Sampling Report – Summary Page
The Sampling Profiler report provides the following view

  • Summary - lists the functions that were executing most frequently when samples were collected and the functions that were performing the most individual work.
  • Call Tree - displays the execution paths of functions in a hierarchical tree.
  • Modules - organizes profiling data by module, and lists the functions, source code lines, and instructions that were executing when samples were collected.
  • Caller/ Callee - organizes profiling data by module, and lists the functions, source code lines, and instructions that were executing when samples were collected
  • Functions - organizes profiling by function, and lists the functions that were executing when samples were collected
  • Lines - lists the source code lines that were executing when samples were collected

Figure 6: CPU Sampling Profiler report
  • Marks - lists profiling marks that were inserted into a profiling data file.
  • Processes - lists process and thread start and end times.
  • Function Details - displays a graphical chart of the relationship between a selected function and the functions that called and were called by the selected function.
  • IPs - lists the source code lines that were executing when samples were collected

Instrumentation Report – Summary Page
The instrumentation profiler report provides following views

  • Summary - lists the functions that consumed the most time and the functions that did the most individual work.
  • Call Tree - displays the execution paths of functions in a hierarchical tree.
  • Modules - organizes profiling data by module, and lists profiling data for the functions in the module.
  • Caller/ Callee - displays profiling data for the parent and child functions of a selected function.
  • Functions - lists profiling data by function.
  • Marks - lists process and thread start and end times.
  • Processes - lists process and thread start and end times.

Figure 7: Instrumentation Profiler report

  • Function Details - displays a graphical chart of the relationship between a selected function and the functions that called and were called by the selected function.

Memory Profiling Report – Summary Page
The memory profiler report provides following views

  • Summary - lists the functions and types that allocated the most memory
  • Call Tree - displays a hierarchical tree that represents the execution paths and memory allocation data of functions in the profiling run.
  • Modules - organizes .NET memory allocation data by module, and lists the functions, source code lines, and instructions that were executing when memory was allocated.
  • Caller/ Callee - lists memory allocation data for a selected function, the functions that called the selected function, and the functions that were called by the selected function

Figure 8:  Memory Profiler Report
  • Functions - lists memory allocation data for a selected function, the functions that called the selected function, and the functions that were called by the selected function
  • Lines  - lists memory allocation data for the source code lines of functions in the profiling run.
  • Allocation - lists the types that were allocated in the profiling run, and the call trees (execution paths) that resulted in the allocation of the type.
  • Marks - lists profiling marks that were inserted into a profiling data file.
  • Processes - lists process and thread start and end times.
  • Function Details - displays a graphical chart of the relationship between a selected function and the functions that called and were called by the selected function.
  • BeleTPL.com

No comments:

Popular Posts