Analyzing performance data for Visual C++, Visual C#, and Visual Basic code in Windows Store apps
This topic describes the performance data for Visual C++, Visual C#, and Visual Basic code that is presented in the report views of the Microsoft Visual Studio Express 2012 for Windows 8 profiling tool. To collect Visual C++, Visual C#, and Visual Basic performance data, see one of these topics:
How to profile Visual C++, Visual C#, and Visual Basic code in Windows Store apps on a local machine
How to profile JavaScript code in Windows Store apps on a local machine (Includes description of how to collect C#, VB, and C++ performance data from an app that is written in HTML5 and JavaScript)
How to profile Visual C++, Visual C#, and Visual Basic code in Windows Store apps on a remote device
In this topic
This topic contains the following sections:
Open the profiling report file
Types of performance data
Just My Code
Types of performance report views
Performance report views
Summary view
Function Details view
Call Tree view
Caller/Callee view
Modules and Functions views
Lines view
Customizing data grid views
Open the profiling report file
When you stop a profiling run from the Visual Studio IDE, the performance data is automatically displayed in a document.
To open a profiling report (.vspx) file that was generated by the VSPerf command line tool or that was saved after a previous profiling run, do this:
If necessary, open Visual Studio.
On the File menu, choose Open File.
In the Open File dialog box, navigate to the folder that contains the profiling report file and then choose the report file.
Types of performance data
The Visual Studio Express 2012 for Windows 8 profiler uses a sampling technique to collect performance data for Visual C++, Visual C#, and Visual Basic code. At an interval that is based on the processor clock, the profiler captures a snapshot of the currently active functions—the call stack. An active function on the call stack is either executing its own code or waiting for functions that it called to execute. For each function in the sampled call stack, the profiler assigns sampling values to the function like this:
If the function is executing code in its own body (and not in a child function), both the Inclusive and Exclusive sample counts of the function are incremented.
If the function is waiting for a child function to return, only the Inclusive sample count of the function is incremented.
Profiling data for a function includes the absolute number of samples collected for the function and the relative percentage of those samples compared to the total number of samples that were collected in the profiling run. The data is calculated for two sets of timing values:
Inclusive values are calculated from the total number of samples collected for a function when it’s on the call stack, including samples that are collected when child functions are being executed. When a sampled call stack is analyzed, the inclusive sample counts of all functions on the call stack are incremented.
Exclusive values are calculated from the total number of samples collected for a function when it’s executing its own code. Exclusive values do not include samples that are collected when child function are being executed. When a sampled call stack is analyzed, the exclusive sample count is incremented only for the function that is executing code in its function body.
Types of performance report views
Profiling report views display data in two ways:
Call graph views show you information about functions in the context of execution paths.
The Hot Path tree on the Summary window shows the execution path for which the greatest number of samples that took the greatest amount of time in the profiling run.
The Call Tree view is a call graph for all the execution paths that were sampled in the profiling run.
The Function Details and Caller/Callee views focus on a selected function, displaying the functions that called the selected function, and the functions that it called.
Call graph views help you to find performance issues in your algorithms.
Function list views display data performance data for functions in a table. You can sort the functions by choosing a data column.
The Functions With Most Individual Work list on the Summary page shows you the functions with the greatest number of exclusive samples that were collected in the profiling run.
The Modules view groups functions by the .dll or .exe file that contain them.
The Functions view is a single list of functions.
The Lines view displays performance data for the function statements that were executing when a sample was collected.
You can navigate between views by selecting a function and choosing a new view from the Current view drop-down list.
Just My Code
By default, the profiler uses Just My Code functionality when it creates reports. When the profiler analyzes call stack information, it determines whether a function on the call stack is a member of your code or a member of system code, such as a method in the .NET Base Class Library. When Just My Code is enabled and the function is a call to system code, the profiler analysis adds all subsequent samples that are collected for the call stack to the exclusive and inclusive values of the first system call. Therefore, system calls are rolled up into the first system call, which helps you to concentrate on optimizing your own code.
To change the default Just My Code behavior and view all calls to system calls, do this:
On the Tools menu, choose Options.
In the Options dialog box, choose Performance Tools and then choose General.
In the Just My Code group, clear the Enable Just My Code for profiler reports (sampling) check box.
Performance report views
Summary view
The Summary page gives you two views of the profiling data that can often point you to the best candidates for performance optimization.
The Hot Path tree shows you the call stack with the greatest number of samples in the profiling run. Understanding the reason that this algorithm takes up so much time can lead to an optimization.
The Functions With Most Individual Work list presents the ten functions that used the most exclusive time. You can achieve quick and significant performance gains by optimizing the function code or reducing the number of times these functions are called.
To open a Function Details view for the function, choose a function name in the Summary view.
Function Details view
The Cost Distribution bar chart represents the relationships between a function that you select and the calling functions that executed the selected function, and between the selected function and the functions that were called by it.
The Calling Functions bar shows the functions that called the selected function. The size of a calling function block indicates the percentage of the total execution time of the selected function that was caused by the calling function.
The Selected Function bar indicates the relative amount of the total execution time that the selected function spent executing its own code (the Function Body block) and the amount of time spent executing functions called by the selected function.
The Called Functions bar shows the functions that were called by the selected function. The size of a called function block indicates the percentage of the total execution time of the called function that was spent in the called function.
You can choose a calling or called function to make that function the selected function.
Call Tree view
You can use the Call Tree view to explore the function execution paths that were traversed in your app. The root of the tree is the entry point into the app. Each function node lists all the functions that it called and performance data about those function calls. The function values in the Call Tree view are for the function instances that were called by the parent function in the call tree. Percentage values are the ratio of the time of the function instances value to the total execution time of the profiling run.
To focus on one node of the Call Tree view, select the node and then choose Set Root on the shortcut menu. When you set the root node, you eliminate all other entries from the view except the subtree of the selected node. To reset the root node back to the original node, choose Reset Root on the shortcut menu.
Call Tree view columns
Column name |
Description |
---|---|
Inclusive Samples |
The number of samples that were collected for the instances of the function that were called by the parent function in the call tree. The number of samples includes samples that were collected for functions called by the function. |
Exclusive Samples |
The number of samples that were collected for the instances of the function that were called by the parent function in the call tree. The number of samples does not include samples that were collected for functions called by the function. |
Inclusive Samples % |
The percentage of the total number of samples that were collected in the profiling run that were collected for the instances of the function that were called by the parent function. The value includes samples that were collected for functions that were called by the function. |
Exclusive Samples % |
The percentage of the total number of samples that were collected in the profiling run that were collected for the instances of the function that were called by the parent function. The value does not include samples that were collected for functions that were called by the function. |
Module Name |
The name of the module (.dll or .exe) that contains the function. |
Caller/Callee view
The Caller/Callee view is a tree representation of the data in the Function Details Cost Distribution bar chart that includes all timing details. Use the Caller/Callee view to investigate the relationship between a selected function and the functions that called it and the function that it called. The Caller/Callee view is made up of three grids.
The Current function that is displayed in the middle grid displays profiling information about the selected function. The values include samples from all calls to the function. The Functions that called the current function are displayed in the top grid and the Functions that were called by the current function are displayed in the bottom grid. The values of the current function are the totals from all sampled calls to the function. The values of the calling and called functions include only the samples collected for the function when it was calling or being called by the selected function.
To navigate the call trees of a function double-click a calling or called function. This will make the selected function the new selected function and show you its callers and called functions.
Caller/Callee view columns
Column name |
Description |
---|---|
Inclusive Samples |
|
Exclusive Samples |
|
Inclusive Samples % |
|
Exclusive Samples % |
|
Modules and Functions views
The Modules and Functions views display the details of the profiling data for the functions in the profiling report. The Modules view organizes the JavaScript functions by the .js source file that contain them. Other functions are listed by the module, such as a .dll. The Function view lists all functions without using a hierarchy. Finding your own code in the Modules view is often easier than the Functions view, but you might find it easier to compare functions in the Functions view.
Modules and Functions views columns
Column name |
Description |
---|---|
Inclusive Samples |
The number of samples that were collected when the function was on the call stack. The number of samples includes samples that were collected for functions called by the function. |
Exclusive Samples |
The number of samples that were collected when the function was executing its own code. Exclusive samples do not include samples that were collected when functions that were called by the function were executing. |
Inclusive Samples % |
The percentage of the total number of samples that were collected in the profiling run that were collected when the function was on the call stack. The numerator is the Inclusive Samples of the function. The denominator is the total number of samples that were collected for the profiling run. |
Exclusive Samples % |
The percentage of the total number of samples that were collected in the profiling run that were collected for the function. The value does not include samples that were collected for functions that were called by the function. |
Lines view
The Lines view of sampling data lists performance data for the statements that were executing when the samples were collected in the profiling run. In a source file, a statement can span more than one line in a source file, and a single line can include more than one statement.
Column name |
Description |
---|---|
Inclusive Samples |
The number of samples that were collected for the line in the profiling run. The number of samples includes samples that were collected for functions called by the line. |
Exclusive Samples |
The number of samples that were collected for the line in the profiling run. The number of samples does not include samples that were collected for functions called by the line. |
Inclusive Samples % |
The percentage of the total number of samples that were collected in the profiling run that were collected for the line. The value includes samples that were collected for functions that were called by the line. |
Exclusive Samples % |
The percentage of the total number of samples that were collected in the profiling run that were collected for the line. The value does not include samples that were collected for functions that were called by the line. |
Source Line Begin |
The starting line number in the source file at which this sample was collected. |
Source Character Begin |
The offset of the starting character in the source file line at which this sample was collected. |
Source Line End |
The ending line number in the source file at which this sample was collected. |
Source Character End |
The offset of the ending character in the source file line at which this sample was collected. |
Customizing data grid views
You can add or remove data columns and change the order in which the columns are displayed. Open the shortcut menu for a table header row and choose Add/Remove Columns. Select the checkboxes of the columns that you want to view, and clear the checkboxes of the columns that you want to hide. Use the arrow buttons to move a selected column.
Additional profiling data columns
Column name |
Description |
---|---|
Function Address |
The memory address of the function. |
Function Line Number |
The line number of the start of this function in the source file. |
Source File |
The source file that contains the definition for this function. |
Module Name |
The name of the module that contains the function. |
Module Path |
The path of the module that contains the function. |
Process ID |
The process ID (PID) of the profiling run. |
Process Name |
The name of the process. |