Interpreting profiling data

After gathering the profiling data, you can analyze the data in the QNX Application Profiler perspective. In the Execution Time view, the results show as precise function execution time, and a runtime call graph for Function Instrumentation.

Manage profiling sessions

The Profiler Sessions view shows the following information as a hierarchical tree for each profiling session:

Session ID
A consecutive identifier assigned to each profiler session
Session Name
Launch instance name (for example, ApplicationProfiling)
Session State
The current state of the session (open, closed)
Session Timestamp
The date and time the session was created

The Debug view shows the target debugging information in a tree hierarchy. The number displayed after a thread label is a reference counter, not a thread identification number (TID).

The Momentics IDE shows stack frames as child elements, and it shows the reason for the suspension beside the thread (such as the end of the stepping range was reached, a breakpoint was encountered, or a signal was received). When a program exits, the Momentics IDE also shows the exit code.

Screen showing the Debug view in the Application Profiler.

The Execution Time view

The Execution Time view helps you identify which functions consume the most CPU time, which makes them candidates for optimization. This data-collection technique lets you gather precise information about the amount of time that the processor spends in each function, and provides stack trace and call count information at the same time.

Screen showing data in the Execution Time view.

In the Execution Time view, the Table view displays profiling data in these columns:

Name
The name of the function. In addition, you can view who called the function, and how much time each function took to execute in the context of a caller.
Deep Time
The time it took to execute the function and all of its descendants. It is the pure real time interval from the time the function starts until it ends, which includes the shallow time of this function, the sum of the children's deep times, and all time in which the thread isn't running while blocked in this function. Deep Time is also referred as the Total Function Time. When this function is called more than once, it's the sum of all the times it's called from a particular stack frame, or from a particular function.
Shallow Time
The deep function time minus the sum of its children's calculated times. It roughly represents the time that the processor spent in a particular function. However, for this type of analysis, it also includes the time for kernel calls, the time for instrumented library calls, and the time for profiling the code.
Count
The number of times the function was called.
Location
The location in the code where the function can be found.
Percent
The percentage of deep time compared to the total time.
Average
The average time spent in the function.
Max
The maximum time spent in the function.
Min
The minimum time spent in the function.
Time Stamp
A time stamp assigned to the function, if any (the last time the function was called).
Binary
The file name for the binary.

Customize how data is displayed

You can use the preferences to customize the number of columns, their order, and the format of the data that is shown in the Execution Time view. For example, you might want to select more columns to add more detail information to your view.

  • In the Execution Time view, click the toolbar menu and select Preferences.

Screen showing setting user preferences for the Execution Time view.

Show a threads tree

You can view a graphical representation of the threads and calling functions within your app. You can expand the tree to see the detail of the lowest function calls.

You can use the threads tree data to identify which threads are the most and least active, and to determine the appropriate size of your app's thread pool. If there are idle threads, you might want to reduce the size of the pool.

  1. In the Execution Time view, click Show Threads Tree icon.

    Screen showing an example of a threads tree in the Execution Time view.

  2. To view quantitative profiling values, in the annotated source editor, hover the pointer over a colored bar. The CPU usage appears, and shows as percentage and time values.

Show table mode

The table mode shows a list of functions from the apps in your project. It doesn't show calls to functions in the C library, such as printf.

  1. In the Execution Time view, click Show Table icon.

    Screen showing an example of table mode data in the Execution Time view.

    A list of functions for the selected session is displayed in the Execution Time view.

  2. From this table, to show the calls of a specific function, select a function, right-click, and select Show Calls.

Show calls

The call tree shows you a list of all of the functions called by the selected function. Using a call tree, you can see exactly where the app spends its time, and which functions are used in the process. The call tree lets you drill into specific call traces to analyze which ones have the greatest performance impact. To set the starting point of the call tree, drill down from a thread entry function to see how the actual time is distributed for each of its function descendants.

  • In the Execution Time view, right-click a function and select Show Calls.

Show reverse calls

A reverse call tree lists the functions that called the selected function. It shows what is calling a specific function, and how its time was distributed for each of those callers. You can use a reverse call tree to drill up or down the stack to view the callers and their contribution time, until you encounter a thread entry function.

  • In the Execution Time view, right-click a function and select Show Reverse Calls.

Show call graphs

A call graph is a visual representation of how the functions are called within the project. If you position your cursor over a function in the graph, you will see Deep Time, Percent, and Count information for that function, if any.

You can show call graphs only for functions that were compiled with profiling enabled.

  1. In the Execution Time view, right-click a function and select Show Call Graphs.

    Screen showing an example of a simple call graph in the Execution Time view.

    This call graph shows a pictorial representation of the function calls. The selected function appears in the middle, in blue. On the left, in orange, are all of the functions that called this function. On the right, also in orange, are all of the functions that this function called.

  2. To see the calls to and from a function, click the function.

Interpret tree mode data

The following table describes the Execution Time view columns when viewing data in a tree mode:

Node Deep Time Shallow Time Count Average Max (Min)
Group Node (Reverse Call Tree Mode, Table Mode) Same as Shallow Time The sum of Shallow Time for the children The sum of Count for the children Deep Time / Count Max (Min) of children
Function (All) The sum of the Total Deep Function Time for each instance of this function in a timed call tree, excluding inner recursive frames The sum of the Shallow Function Time for all instances of this function in a call tree. The Shallow Function Time for the call tree is the Total Deep Function Time minus the sum of the Total Deep Function Time for all descendants. The sum of all counts to this function in the call tree (Deep Time + Rec. Time) / Count The Max (Min) of the Total Deep Function Time between all instances
Thread (Call Tree mode) The sum of the total for entry functions (only one entry, but there might be some unattached calls) Same as Total 1 N/A N/A
Call Pair (Call Tree mode) The sum of the Total Deep Function Time for all instances of this call pair for a given parent backtrace N/A Call Count of this call pair for a given parent backtrace Deep Time / Count Max (Min) of this call pair's Total Deep Time for a given parent backtrace
Self (Call Tree mode) Same as Shallow Time The parent Total minus the sum of the Total for the siblings Count of a parent Shallow Time / Count Max (Min) of this call pair's Shallow Time for a given parent backtrace
Recursive Call Pair (Reverse Call Tree mode) N/A N/A The sum of Call Counts for a given pair N/A N/A
Call Pair, Thread, Process (Reverse Call Tree mode) The sum of Total Call Pair time for the Root function for a given stackframe (the child in this tree represents the parent in the call stack) N/A The sum of Call Counts for the Root function for a given stackframe Deep Time / Count N/A

Show source code for a function

Occasionally, you need to view the source code for a function that might require further investigation. You can easily jump to the source code and compare the profiling results against the actual code to determine if the data is acceptable, or if it's a candidate for further optimization.

  • In the Execution Time view, right-click a function and select Show Source.

Show the execution time for a function

The annotated source editor lets you see the amount of time your app spends on each line of code and in each function.

If you change your source after compiling, you may receive incorrect profiling information because the annotated source editor relies on the line information provided by the debuggable version of your code.

  1. In the Profiler Sessions view, select your app.
  2. In the Execution Time view, double-click a function that you have the source for. The Momentics IDE opens the corresponding source file in the annotated source editor.

    Screen showing the annotated source editor.

The annotated source editor shows a solid or graduated color bar graph on the left side, and provides a tooltip with information about the total number of milliseconds for the function, the total percentage of time in this function, and for children, the percentage of time in the function as it relates to the parent.

The length of the bar represents the percentage. On the first line of the function declaration, that bar provides the total for all time spent in the function. The totals include:

  • The amount of time for the inline sampling or call-pair data.
  • The CPU time spent on a line of code as a percentage of the app's total CPU time. Within a function, the lengths of the green bars add up to the length of the yellow bar.
  • The total function time, usually on the first line of the function declaration.

The colors on the bars represent:

Green-Yellow
The amount of time for the inline sampling or call-pair data.
Blue-Yellow
The time it took to execute the function and all of its descendants. For the function, it includes the period from the time function starts until it ends, which includes the shallow time of this function, the sum of the children's deep times, and all time in which the thread isn't running while blocked in this function.

To view quantitative profiling values:

  • In the annotated source editor, let the pointer hover over a colored bar. The CPU usage appears, shown as percentage and time values.

Screen showing quantitative profiling values in the annotated source editor.

Duplicate a view

You can create a second Execution Time view to see data side-by-side in another window using the menu option Duplicate View. The new view is disconnected from Profiler Sessions view; however, it maintains its own history. You can use this feature to observe a snapshot of your program, and then continue to monitor the results while your app runs in another pane.

  • In the Execution Time view, click the menu icon from the toolbar and select Duplicate View.

View the history

The Execution Time view keeps track and maintains a record of where have been. You can use the Go Back and Go Forward icons from the toolbar, or select a particular entry in the navigation history. You can set the navigation history size in the preferences for the view.

Group data

The grouping feature helps you organize large function tables, and improve navigation and analysis. It is the most efficient method to observe aggregated time results for each software component (binary or file).

On the Execution Time view menu, select Group By.

Screen showing menu options for grouping.

Filter data

When grouping doesn't help reduce the amount of profiling data from the results, you can use filters to remove some rows from the table. Component filtering lets you see only those records related to the specified component, or you can use Data filtering to filter based on timing values.

When filtering is applied, the <filtered> element remains in the view as a reminder of the filtered elements, and the total number of these elements is visible in the Count column.

  1. On the Execution Time view mneu, select Filters.
  2. Specify the filters that you want to use, and then click OK.

Screen showing the Filters dialog box.

Search profiling data

You can perform a text search on the data results from the profile. The Find feature includes a Find bar at the bottom of the Execution Time view. The view automatically expands and highlights the nodes in the tree when the search locates results matching the search criteria.

  • On the Execution Time view menu, select Search.

Last modified: 2014-11-17



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus